Ayrton Senna
Ayrton Senna

Reputation: 3855

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

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

Upvotes: 2

Views: 242

Answers (1)

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121010

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.

Upvotes: 4

Related Questions