I think it is also worth pointing out that Behaviours are inherited from Erlang, whereas Protocols are unique to Elixir. In my mind Behaviours are more comparable to interfaces in languages like Java and C#, and Protocols are more like Haskell type classes, except they cannot be polymorphic only in the return type like they can be in Haskell. I don’t think its possible to implement mempty for example.
3 Likes


















