The question in the subject line is pretty self-explanatory, and I’m trying to understand perhaps a hidden misunderstanding. My understanding is that @impl true
tells that compiler that the function below it implements a behaviour and will thus check so. Then the behavior of @impl <behaviour>
is the same except it additionally checks that the name of the function below it implements a callback of the same name defined by <behaviour>
. The documentation also states that false
may be passed to @impl
, but it does not state what @impl false
does. So, I’m not sure what it does do.
In my experience, Elixir developers tend to only use @impl true
, but I honestly cannot understand why. With only a few more characters in most cases, you get an additional check and additional clarity, both in single behaviour and multiple behaviour uses. So, I’m both confused why @impl true
is in the language and why developers use it.
So, what are the benefits, if any, of @impl true
over @impl <behaviour>
? Why should one not always use @impl <behaviour>
?