[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lambda (was Re: special forms, take two (was Re: A lua version of "amb"))
- From: Mark Hamburg <mark@...>
- Date: Wed, 29 Feb 2012 20:15:51 -0800
One of the issues I have heard Roberto raise regarding compact syntax is that it leads people to expect it to be efficient and they grouse when it isn't or they go to great lengths to avoid using more general but somewhat less efficient forms. (... is a prime example.)
One of the problems with syntactically lightweight lambdas is that they make creating functions easier than might be expected. In particular, a function with upvalues can involve not just one but multiple heap allocations.
What if the lightweight syntax didn't support functions with upvalues? One could still reference globals, but a reference to a lexically bound but non-local variable would be an error in a lambda expression, whatever the syntax. This would mean that lambdas could be allocated once at load time for the bytecode rather than at each instantiation. The distinction from functions would be justified/clarified by the fact that these are created using different syntax.
Are these still interesting?
Mark