
Learning Elixir
By :

In this chapter, we discussed a number of topics concerning Elixir and metaprogramming.
Typespecs are used as a means for documenting code (with code) such that other programmers (and ourselves) will know at a glance the expected types of certain functions. Typespecs are also a great tool for annotating code, functions, and modules for static analysis, and for finding type issues or other bugs typically unavailable to dynamically-typed languages.
Behaviours can be thought of akin to interfaces from OO languages. They are a means to define modules that will have a set of public functions with specific arity. If the modules adopting a behaviour do not define any or all of the functions from the behaviour, Elixir will raise a compiler warning.
Protocols are a means of performing high-level pattern matching and function dispatching for certain actions. For example, translating types into printable strings requires implementation of the String.Chars
protocol for the specific type. This...
Change the font size
Change margin width
Change background colour