3 ms·
I'm still learning Elixir, but the sigils approach to these kinds of problems is interesting. https://elixir-lang.org/getting-started/sigils.html https://elixi
by nixpulvis 8y ago
I'm still learning Elixir, but the sigils approach to these kinds of problems is interesting.
https://elixir-lang.org/getting-started/sigils.html https://elixir-lang.org/getting-started/sigils.html
- agumonkey 8y agointeresting, python got a subset of that not long ago
- inferiorhuman 8y agoSure, that's not really unique to Elixir though. You've had things like that in Ruby (e.g. %w, %W, %r, etc) and Rust (e.g. r").
- nixpulvis 8y agoBut you can make custom sigils.
- inferiorhuman 8y ago> But you can make custom sigils. Judging by the downvotes I seem to have set off the Elixir fanboys. You can't define additional string interpolation syntax with Rust, but you can define custom functions to convert from a string to any given type with the Into trait. You can also use arbitrary delimiters with the raw string syntax. As another comment pointed out, Scala lets you define the equivalent of custom sigils. Elixir brings good, bad, new, and old things to the table but custom sigils are not particularly new or unusual.
- kodablah 8y agoStill similar things are available in other languages, e.g. https://docs.scala-lang.org/overviews/core/string-interpolation.html https://docs.scala-lang.org/overviews/core/string-interpolat...