[erlang-questions] How to get the line number of current executable code?
Andras Georgy Bekes
bekesa@REDACTED
Thu Aug 21 12:16:23 CEST 2008
> - the meta-data for a module records which exported functions are
> pure and which are not
> - when the compiler notes a pure function calling a function
> from another module, it records a dependency on that function
> being exported as pure
> - when a module is loaded, the run time system checks that
> every function it tries to import as pure from some other
> module IS pure if that module is already loaded,
> every module that depends on this one exporting some
> function(s) as pure is satisfied.
> If either check fails, the module is not loaded.
This is completely against current Erlang practice.
Currently if a module A uses module B, noone checks if B contains the
used functions or not. Neither at compile time, nor at module load
time. I think because the check would make module upgrades way more
difficult.
Think about a module B using a function AF from module A. In the next
version of the modules, the function A:AF is removed and B is not using
it any more. Currently you just load the two modules. In the presence
of a load-time check, you'd have to load module B first, then A. No
problem here.
Now think about a module A using B's BF and B using A's AF. When both
functions are removed, there is no legal upgrade order.
The same problem exists with checked pure functions. Module A using B's
pure BF (and expects it to be pure), and B using A's pure AF (and
expects it to be pure). In the next version both the functions switch
to impure, together with their consumers. There is no legal upgrade
order :-(
There probably are solutions (simultaneous atomic loading of several
modules? using extra transition module versions to make the upgrade
possible?), but current module upgrading technology/practice must
change radically.
Georgy
More information about the erlang-questions
mailing list