Compile Time vs. Runtime
Elixir is a compiled language, so your code is transformed before it executes. (Mix handles compilation for us, and files are only recompiled when they change.) Elixir’s compiler reads your files from top to bottom to construct the modules and functions that are used in your application.
This is a big departure from Ruby, where code is evaluated and executed at runtime. Many new Elixir developers get confused by what is compile time and what is runtime. The difference matters because you can introduce subtle bugs—or absolute show-stoppers—without being able to identify where the problem is. This section will equip you with just enough to minimize that confusion.
The simplest explanation is everything inside of a function ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access