[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Short function definition syntax; thoughts on Lua (was Re: [ANN] GSL Shell new beta release...)
- From: Philippe Lhoste <PhiLho@...>
- Date: Fri, 04 Dec 2009 17:26:23 +0100
On 04/12/2009 11:12, Luiz Henrique de Figueiredo wrote:
And one possible syntax could be
function (x, y, z) x + y * z end
which isn't much longer (even more looking at the proposed -> alternative...), remains
close of current syntax and clearly defines where the expression ends.
Actually, it only makes 'return' optional, which isn't unlike JavaFX (which might have
taken the idea from some other language(s)) which considers that the last expression of a
function is the return value of that function.
People will find 'function' still too verbose, but I am not fan of |x| or \x syntaxes
within Lua which doesn't abuse of such notations (they are fines in themselves, of course).
So perhaps we can reuse some keyword in a different context (I might miss some syntactic
ambiguity, though), eg.:
do: (x, y, z) x + y * z end
-- (near) Paris -- France
-- -- -- -- -- -- -- -- -- -- -- -- -- --