lua-users home
lua-l archive

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


On Sun, Nov 21, 2010 at 8:52 PM, Mark Hamburg <mark@grubmah.com> wrote:
> Though in that case, we could presumably also use the | token and avoid syntactic ambiguity:
>
>        | arg list | expression
>        | arg list | do statements end

That has always been my favourite, and I like the do..end form
(although it's less important because the syntax overhead for
multiline functions isn't too much).

Another contender was suggested by Luiz, which is \x,y(x+y) - ie.
'lambda'.  It has the advantage of being easily implemented by a token
filter and the scope of the expression is completely unambiguous.

I also like Mark's suggestion that the short function form can be the
single argument of a function without parentheses, like strings and
table literals.

But there is a widespread idea that this is (a) redundant and (b) not
in the Lua keyword-driven spirit.  I think it makes the functional
style of programming less 'noisy' - the issue is not 'typeability'  so
much as  'readability'.  I understand that this belief isn't shared by
everyone ;)

Well, language design is not a popularity contest - or should not be.
But this proposal has a certain elegance to it.

steve d.