[erlang-questions] Drive by mention of new features without explaination

Björn Gustavsson bgustavsson@REDACTED
Tue Dec 8 08:03:58 CET 2009

On Mon, Dec 7, 2009 at 11:23 PM, Jayson Vantuyl <kagato@REDACTED> wrote:
> Why have false unload the module?  It appears that there are broken semantics.  As if "on_load" really is semantically closer to "should_load_and_convenient_side_effects".  I'd much rather have on_load return either ok or some error that could be logged intelligently.  Fitting in with load_nif is just a bonus.

It makes sense. Currently, if the on_load function returns anything
but 'true', the module will be unloaded, so it is not really a true
boolean anyway.

Therefore, I suggest the following change for R13B04:

The on_load function must return 'ok' if the function is to remain loaded.

Returning any other value (or causing an exception) will cause the
module to be unloaded.
In addition, if the return value is {error,Anything}, a message will
be written to the error_logger.

Unless someone finds any problem with this, I'll probably implement
the new semantics
within a few days.

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list