[erlang-questions] Drive by mention of new features without explaination
Jayson Vantuyl
kagato@REDACTED
Mon Dec 7 23:23:19 CET 2009
> If the on_load handler were to return 'ok' when it is successful then what
> should it return on failure, 'error'? It still can't return what
> erlang:load_nif does as its error returns are quite specific. And there
> might actually be people who use the on_load handler for other things than
> calling load_nif.
Actually, why can't it return {error,Reason}? gen_server's return all manner of custom {error,_} tuples that can be handled with fairly generic code because it's really a rather complete idiom.
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.
Additionally, {ok,_} might have other uses in the future. true / false pretty much makes any extension to the syntax yield a completely broken idiom.
Conversely, what good does true / false do? It's rather arbitrary and certainly uninformative. At least being congruent with load_nif wouldn't be completely arbitrary.
--
Jayson Vantuyl
kagato@REDACTED
More information about the erlang-questions
mailing list