[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lambda (was Re: special forms, take two (was Re: A lua version of "amb"))
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 1 Mar 2012 10:23:09 +0200
> 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.
>
My take on lightweight function syntax is this:
Will lightweight function syntax save, in total over all my
programs, more code characters than its implementation
in Lua core would require? Will the time saved in reading
my programs compensate for the extra paragraph in the
Lua user's manual?
My profile is this:
1. I'm only ever going to use it for anonymous functions.
2. Any function that I use more than once in all the Lua
programs I ever write, should have a name, the same
name, every time I use it.
3. So I'm only ever going to use lightweight function
syntax for one-off anonymous functions.
I think there is a place for lambda-style syntax.
I don't think that place is Lua.
Dirk