Why the syntax for defining sigils in Elixir doesn't use "defsigil"? -
i reading page sigils in elixir tutorial.
expected syntax defining sigils uses "defsigil" "defstruct", "defprotocol", , on.
not so.
why?
the original sigil syntax def __s__ s character used sigil (this def sigil_s.) can see in initial commit started work on sigils. believe work started before macros implemented.
this syntax required hack allow them imported can read in this issue.
today, when writes %f"foo", translates f("foo", []). proposal change translation to: sigil_f("foo", []).
this change brings 2 benefits:
1) name more explicit;
2) allows remove hack in our importer. today, import hello brings functions hello not start underscore makes exception sigils;
you can see in discussion other suggestions such defmodule sigil.s suggested, def sigil_s syntax chosen.
the actual commit implements these changes https://github.com/elixir-lang/elixir/commit/c6284557e792efd67f13f421b723a7a301bdbb93
i not sure why not defsigil perhaps nobody suggested it? best guess given @ time of post, searching "defsigil" on google returns question. if mentioned on github or irc there have been mention of in search results.
Comments
Post a Comment