TIL a shortcut for aliasing the current module in Elixir
Published in
1 min readOct 9, 2019
When using structs in Elixir I found I would often have to reference the struct itself. You can use the __MODULE__
constant for that, however, you can also alias __MODULE__
.
In the example below this is the equivalent of alias ExMessagebird.SMS.Message
, allowing you to reference Message
instead.