Elixir/Phoenix - what are the variables that are prefixed with @ (eg - @type or @impl)

Viewed 90

I'm following some tutorials but got confused seeing these variables, what exactly are these and what are they called?

1 Answers

Those are module attributes.

There are some predefined module attributes, as described in Module documentation. @impl and @type are the predefined ones, described in the documentation for Module I referenced above.

It’s always a good idea to start with the language core and only then dive into frameworks, but since your question also mentioned , it’s worth to mention that Phoenix nicely plays with module hooks, implicitly declaring some module attributes for convenient access to @assigns and like, but this is surely out of the scope of your current journey.

Related