[erlang-questions] Improve $handle_undefined_function

Loïc Hoguin essen@REDACTED
Tue Jan 22 16:07:34 CET 2013

On 01/22/2013 03:41 PM, Björn Gustavsson wrote:
> On Tue, Jan 22, 2013 at 1:02 PM, Loïc Hoguin <essen@REDACTED
> <mailto:essen@REDACTED>> 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 thread.
> Except that your "improvements" to $handle_undefined_function
> renders it completely useless for the problem it was supposed
> to solve.
> Namely to emulate the existing -extends() directive, which is
> used as follows:
> -extends(Module).
> where Module is the module to be extended. [1]
> 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.

This statement alone makes me go back to thinking -extends() should be 
dropped, and if not, $handle_undefined_function shouldn't be used and 
should be dropped; it's incompatible with tools, prone to user error, 
and is going to make half the community scream in terror.

As Jose Valim said right after you, the parse transform can simply look 
at the original module directly. If it can't, then there's no fixing it.

Loïc Hoguin
Erlang Cowboy
Nine Nines

More information about the erlang-questions mailing list