On Thu, Oct 27, 2016 at 7:12 AM, Martin Karlgren <ma...@roxen.com> wrote:
>> 26 okt. 2016 kl. 21:23 skrev Chris Angelico <ros...@gmail.com>:
>>
>>> 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.
>
> Yep – don't know about other people but I don't think I've ever really wanted 
> "late binding", so I think that's a good thing.

I have, often. It's also the same semantics as most other languages
have for their closures. The most normal way to work with closures
should be late-binding and writeable.

Whether it's worth having a "snapshot" syntax that is strictly
syntactic sugar for the above, now, that's a separate question. In the
times where you *want* late binding, this is the one obvious way to do
it, and as you say, it's pretty verbose.

ChrisA

Reply via email to