Dynamic Code Loading
Dynamic code loading is one of the most surprising features built into the heart of Erlang. The nice part is that it just works without you really being aware of what’s happening in the background.
The idea is simple: every time we call
someModule:someFunction(...)
, we’ll always call the latest
version of the function in the latest version of the module,
even if we recompile the module while code is running in this
module.
If a
calls b
in a loop and we recompile
b
, then a
will automatically call the new
version of b
the next time b
is called.
If many different processes are running and all of them call
b
, then all of them will call the new version of
b
if b
is recompiled. To see how this works, we’ll write two little ...
Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.