[erlang-questions] erl_eval function object

Hans Bolinder hans.bolinder@REDACTED
Fri Aug 21 14:29:09 CEST 2009

[Paul Mineiro:]
> The documentation for erl_eval says that the NonlocalFunctionHandler is
> called when a functional object (fun) is called; however I'm not seeing
> this.

[I replied with some nonsense:]
> There is a functional object for every fun-end expression, and it is
> created in one of the clauses of the erl_eval:expr/5 function. As
> indicated by the "ugly hack" comment in that clause, the fun's
> existence is an implementation detail; it is possible (but unlikely)
> that some day the fun will no longer be needed.

Correction. A fun will always have to be created.

The non-local function handler is primarily a means to implement the
restricted shell mode (see shell(3)). Some harmless calls are skipped,
which makes it somewhat simpler to write non-local function handlers.

erlang:apply--which is skipped when calling non-local function
handlers--is already mentioned in a note. I'll extend that note to
mention shell funs as well.

Best regards,

Hans Bolinder, Erlang/OTP team, Ericsson

More information about the erlang-questions mailing list