{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/6414","repository_url":"https://api.github.com/repos/elixir-lang/elixir","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6414/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6414/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6414/events","html_url":"https://github.com/elixir-lang/elixir/issues/6414","id":246941414,"number":6414,"title":"Nested Sigils","user":{"login":"meyercm","id":535889,"avatar_url":"https://avatars1.githubusercontent.com/u/535889?v=4","gravatar_id":"","url":"https://api.github.com/users/meyercm","html_url":"https://github.com/meyercm","followers_url":"https://api.github.com/users/meyercm/followers","following_url":"https://api.github.com/users/meyercm/following{/other_user}","gists_url":"https://api.github.com/users/meyercm/gists{/gist_id}","starred_url":"https://api.github.com/users/meyercm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meyercm/subscriptions","organizations_url":"https://api.github.com/users/meyercm/orgs","repos_url":"https://api.github.com/users/meyercm/repos","events_url":"https://api.github.com/users/meyercm/events{/privacy}","received_events_url":"https://api.github.com/users/meyercm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-08-01T02:57:11Z","updated_at":"2017-08-01T14:15:28Z","closed_at":"2017-08-01T11:26:38Z","body":"### Environment\r\n\r\nChecked in Elixir 1.4 & 1.5 / OTP 19 & 20\r\n\r\n### Current behavior\r\n\r\nSigils terminate as soon as a matching delimiter is found. Using different delimiters for nested sigils is a workaround, but unsatisfying and mildly problematic.\r\n\r\nThe problem can be demonstrated with stdlib sigils, but this example uses [ShorterMaps] (https://github.com/meyercm/shorter_maps) to provide a more realistic use case. \r\n\r\n```elixir\r\niex> import ShorterMaps\r\n...> ~M{subscriber_id, params: ~M{channel, node}} = %{subscriber_id: 1, params: %{channel: :test_chan, node: node()}}\r\n** (SyntaxError) iex:2: unexpected token: }\r\n# Now switch the inner sigil delimiter to ( ): \r\n...> ~M{subscriber_id, params: ~M(channel, node)} = %{subscriber_id: 1, params: %{channel: :test_chan, node: node()}}\r\n%{params: %{channel: :test_chan, node: :nonode@nohost}, subscriber_id: 1}\r\n```\r\n\r\n### Expected behavior\r\n\r\nFor the matched sigil open delimiters `( [ < {`, I expect that the parser should count additional open delimiters, and not terminate the sigil until finding that many closing delimiters.\r\n\r\nAs ShorterMaps is intended to be a syntax replacement for maps, my preference is to always use `{ }`; because ShorterMaps can embed arbitrary Elixir in the sigil, to include function calls, lists, tuples, and binaries, fixing this issue reduces the cognitive load of choosing the right terminator for a particular use case.\r\n\r\nIt appears that this issue was looked at in 2012 with #743, but I'm hopeful that there is a more feasible approach available now.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments/319382816","html_url":"https://github.com/elixir-lang/elixir/issues/6414#issuecomment-319382816","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/6414","id":319382816,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars0.githubusercontent.com/u/9582?v=4","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2017-08-01T14:15:28Z","updated_at":"2017-08-01T14:15:28Z","body":"Thanks for the clarification.\r\n\r\nI am afraid it doesn't change the answer much. To achieve what you want, you must escape the separator, as in any way textual representation of code. For example, imagine I have a string that represents Elixir code, you would need to write this:\r\n\r\n    \"this_is_a_string = \\\"foo\\\"\"\r\n\r\nSo you either need to change the terminator or escape them.\r\n\r\nAnd we generally don't treat Elixir 2.0 as an opportunity to make breaking changes. The goal for Elixir v2.0 is to remove the deprecated code that we added throughout the 1.x series."}}
{"actor":{"display_login":"josevalim"}}