@impl Attribute

In this episode we’ll look at the @impl attribute and how it can be used to make code more readable.


@impl is actually one of my favorite attributes. I do however use it in a different way, for example, in the code you showed I would have used @impl GenServer to make it clear which behaviour is being implemented.

The issue with this approach however, is that to avoid doing @impl MyApp.SomeModule.MyBehaviour everywhere, I usually have to put an alias call before, which messes up the Elixir style guidelines which say that an alias should be after a behaviour call.

But oh well, good to know you’re still rocking!

1 Like