You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid compile warnings when implementing an empty protocol
Implementing a protocol creates a module that implements the
behaviour given by the protocol. A protocol that defines no
functions by extension defines no callbacks, and so won't be
recognized as a behaviour by the Erlang compiler. This means
that Elixir will log a warning when implementing such a protocol,
because behaviour_info/1 won't be defined on it, and so Elixir
also won't recognize it as a behaviour.
Erlang offers no mechanism to explicitly denote a module as
defining a behaviour, but in this case we know that every protocol
implementation must define an impl/1 function. By adding a callback
that describes this function to all protocols, the warning can be
avoided.
0 commit comments