Compile-Time Hooks
Learn to fix the test macro using compile-time hooks.
The before_compile
module attribute
Elixir allows us to set a special module attribute, @before_compile
, to notify the compiler that an extra step is required just before compilation is finished. The @before_compile
attribute accepts a module argument where a __before_com- pile__/1
macro must be defined. This macro is invoked just before compilation to perform a final bit of code generation. Let’s apply this hook to fix our test
macro.
Using the before_compile
module attribute
Let’s ...
Access this course and 1400+ top-rated courses and projects.