lua-users home
lua-l archive

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


On 23 November 2010 20:26, Tony Finch <dot@dotat.at> wrote:
> So I'm leaning towards a syntax like
>
>  function ::= function `(´ [parlist] `)´ <block> end
>             | `\´ [parlist] `(´ [explist] `)´
>             | `\´ [parlist] <funbody>
>
>  funbody  ::= <function> | <dostat> | <ifstat> | <loopstat>

On balance, I think this is my favourite proposal so far.  Perhaps my
only niggle is I'm used to parentheses around an expression resulting
in that expression returning only one value, though I assume \ x,y
(x*x, y*y) will return two. Still, for me personally the trade-offs
with this solution are the easiest to stomach of the proposals I've
seen so far. I particularly like that the syntax works well with
functions containing statements as well as those which just return
expressions.

I don't suppose you've looked at implementing this patch for LuaJIT 2?

Alex