[erlang-bugs] fun_info(F, env) always empty?

Björn Gustavsson bgustavsson@REDACTED
Sun Feb 19 08:46:56 CET 2012


On Fri, Feb 17, 2012 at 6:23 PM, Ulf Wiger <ulf@REDACTED> wrote:
>
> According to the documentation, fun_info(F, env) will always be empty for external funs. It *doesn't* say, of course, that it will *not* be empty for other types of fun, but it would seem a reasonable conclusion.
>
> What gives?

You will see a non-empty empty environment if
the fun has a non-empty environment.

In your case, you will see it if you use the 'no_copt'
option to disable constant propagation (among other
optimizations) or if you rewrite f/0 like this:

f() ->
    f(1, 2).

f(X, Y) ->
    fun() ->
	    X-Y
    end.

/Björn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list