lua-users home
lua-l archive

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


On Thu, Nov 25, 2010 at 11:34 PM, Axel Kittenberger <axkibe@gmail.com> wrote:
> Why everything so complicated?
>
> How about simply this
>
> lambda(x) x == 2

Fine, but then you started to make it complicated ;)  If there are
actual statements in an anonymous function, then the existing syntax
is fine as it is.

I read this as 'lambda' <arglist> <expr>, with the operator 'lambda'
<arglist> having the highest precedence.

Not sure in fact whether multiple return values should even be allowed
in this case .... that is, how one would interpret this?

lambda() (10,20)

The syntax and semantics should be as simple as possible,and then
there are less ugly edge cases.

An objection to keyword 'lambda' is that it is 6 chars as opposed to
one (\) but clearly \ has its own difficulties and seems to have
existing connotations.  I would still claim that 'lambda(x) x==2` is
less visually noisy than `function(x) return x==2 end` and yet visible
enough not to get lost in 'expression noise'.

steve d.