lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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