[erlang-bugs] fun_info(F, env) always empty?
Ulf Wiger
ulf@REDACTED
Sun Feb 19 11:18:21 CET 2012
Ah, of course. Didn't consider that it could be the effect of constant propagation. :)
Thanks.
BR,
Ulf W
On 19 Feb 2012, at 08:46, Björn Gustavsson wrote:
> 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