Generating Functions from External data
Explore how to use Elixir’s module system to embed data and behavior within modules directly from outside sources of information.
We’ve performed compile-time code generation through careful use of macros. In this chapter, we will exploit Elixir’s module system. With advanced metaprogramming, we can embed data and behavior within modules directly from outside sources of information.
When we use Elixir’s module system, countless lines of boilerplate can be removed while producing highly optimized programs. First, we’ll explore how Elixir embeds an entire Unicode database at compile time for its robust Unicode support.
Next, we’ll build MIME-type validation and internationalization libraries, while applying compile-time optimizations that aren’t possible in many languages. ...
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy