On Thu, Oct 27, 2016 at 6:08 AM, Martin Karlgren <ma...@roxen.com> wrote:
> A possible workaround is to cut the reference to the “foo” frame:
>
>   function f = lambda(string var1, string var2)
>                {
>                  return lambda(string arg)
>                         {
>                           write("%O, %O, %O\n”, var1, var2, arg);
>                         };
>                }(var1, var2);
>
> However, this is pretty verbose.

More significantly, this is *early binding* semantics. It captures the
current values of var1 and var2, and won't notice any other changes.

> Also, all variables in the frame referenced by the lambda will be kept 
> around, even if just a single one is actually used in the lambda.
>

This, however, could be changed - it's a simple question of
optimization, so it comes down to "is it worth it". There's no
semantic change there, AFAIK.

ChrisA

Reply via email to