Elixir Expert — How to code our own Sigil’s ?
Sigil Overview
Sigil is a symbol or a letter which can do anything with the binary or a string that can be transformed to some complex format. You can create a magic with Sigil.
We all know that Elixir is extensible to meet the needs of a project by meta programming.
Every body likes less typing while coding. This is where the Sigil comes in to action.
Keep your code simple and powerful.
Sigil Notation
~x/binary/option
note:
x must be single alphabetic letter.
The symbol used to identify the sigil is ~
tilde . Here, x
can be any letter from a..z A..Z
but one has to be careful with predefined sigils like c C s S w W r R
.
The binary
here is the actual string which is delimited with /
however you can use the following as delimiters of binary.
[] () <> // "" '' || {}
All the above symbols can be used as the delimiters for any sigil representation. Here, the option
act as a modifier for the sigil.