3 ms·
Elixir is a functional language, and has the option of modules and protocols so you can define XML#to_string in two ways. Either as a protocol so you could do
by true_religion 11y ago
Elixir is a functional language, and has the option of modules and protocols so you can define XML#to_string in two ways.
Either as a protocol so you could do to_string(this_xml)
Or as a function within the module so you could do XML.to_string(this_xml)
If you use the module function defintion you can import it into your scope via
import XML
then you can write to_string(this_xml) as if it were a protocol.