Thinking about it more, sigils already support `{}` as delimiters, so using
`%` could conflict with struct creation.I don't think it could be `~` either since that would be ambiguous between sigils and single character atoms. On Fri, Oct 25, 2019 at 9:56 AM Ben Olive <[email protected]> wrote: > I really like the idea of a syntax that delegates to a module! > > That would make a pid something like `%Process<0.55.0>` or ` > %Process.Pid<0.55.0>` which is't a big stretch from the current ` > #PID<0.55.0>` > > On Fri, Oct 25, 2019 at 8:49 AM Kelvin Raffael Stinghen < > [email protected]> wrote: > >> > So I really don't think this feature would be usable with sigils. >> >> Yeah, sure, I was just trying to think of examples of the top of my head, >> I’m sure it would still have a lot of limitations, but I think it would be >> worth the try. >> >> > No, they are enforced by the language. >> >> I see. I vote for only caring for the first letter then. >> >> > So this is a separate discussion but what I'd rather see is another >> sigil like mechanism for structs that would make these valid: >> > >> > URI[https://elixir-lang.org]] >> >> Why not actually using sigils for that? With multi letter sigils we could >> do that. Would you want to automatically import that? If that’s the case, >> maybe a better syntax for the feature would be something like: `%URI” >> https://elixir-lang.org”`, so that would delegate the construction to a >> `from_string` function (or macro) on the module for example. >> >> Anyway, I like your idea too, but as you mentioned, that would not >> address my concern, as PIDs are not structs, so I think that multi letter >> sigils would be the way to go for that, since it looks like adding one more >> one letter sigil for it will not get accepted. >> >> Best, >> Kelvin Stinghen >> [email protected] >> >> On Oct 25, 2019, at 04:00, José Valim <[email protected]> >> wrote: >> >> Maybe*. Sigils follow the rules for strings, so they are not really good >> for handling code and this was one of the lessons learned by the >> shorter_maps project. For example, imagine you want to do this: >> >> ~Project{id ~Manager{id}} >> >> It doesn't really work because you have to escape the closing } inside >> the manager. Sure, you could alternate {...} with <...> or something else, >> but that's precisely the point. Sigils are strings, and they are not >> structured text, so you have to escape and handle delimiters accordingly. >> >> The other issue is that sigils are currently lexical, so you would have >> to import the lexical sigil for every struct before your shorter maps >> proposal. So I really don't think this feature would be usable with sigils. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/6ACCD0A4-30C6-4E47-852F-FC4A16EB5CB3%40gmail.com >> <https://groups.google.com/d/msgid/elixir-lang-core/6ACCD0A4-30C6-4E47-852F-FC4A16EB5CB3%40gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAAmo%3D1AZsNC%3DA9NMHFnb4wt3PFLADTp9HktuCNfmXPLbpZcvHQ%40mail.gmail.com.
