[erlang-questions] Improve $handle_undefined_function
Tue Jan 22 15:41:16 CET 2013
On Tue, Jan 22, 2013 at 1:02 PM, Loïc Hoguin <> wrote:
> That's a question about $handle_undefined_function in general, not about
> this specific implementation proposal. Björn is the one who wrote the
> current implementation that's now in master, I don't have to tell him what
> can be done with it, he knows. I do have to tell him how implementing it
> this way improves the usage, though. Which is the sole reason of this
Except that your "improvements" to $handle_undefined_function
renders it completely useless for the problem it was supposed
Namely to emulate the existing -extends() directive, which is
used as follows:
where Module is the module to be extended. 
Your mission, should you decide to accept it,
is to implement -extends(Module) in a parse transform.
You have no knowledge of the the other module. It might
not even exist when the module containing the -extends()
directive is compiled; furthermore, if more functions are
added to the module being extended in the future, you
should still be able to call them from the module
containing the -extends() directive (without recompiling
To make it more concrete, you should implement a
parse transform and use it to compile the following
extender should then be able to call any function in the
module 'mission_impossible' stored on my computer.
will call mission_impossible:foo(42) provided that
foo/1 is exported from mission_impossible.
You may use either the current implementation or
your "improved" version of $handle_undefined_function,
at your choice.
Should any of your computer systems crash or burn,
the Secretary will disavow any knowledge of your
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions