[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Shorter lambda forms (was Re: (kick,ass): => kick( ass ) ::)
- From: pan shizhu <pan.shizhu@...>
- Date: Sun, 7 Feb 2010 11:02:53 +0800
On Sun, Feb 7, 2010 at 5:07 AM, Majic <majic.one@gmail.com> wrote:
> Technically, since function whatever() ... end is just syntactic sugar
> for whatever = function () .. end, perhaps just using () should become
> a way to denote a function? Since {} is used to denote a table,
> perhaps you could do whatever = () ..end. However I still prefer
> being as verbose as possible about my types, and i don't like the
> |param1, param2| ickiness that stems from Ruby. Who knows... just a
> thought... I pride Lua on being as verbose as possible (within
> reason), so I'm not really pushing for a way to help other scripters
> be lazy typists :p
> Regards :)
What we need is to replace the begin and end.
Lua table use { as begin and } as end.
So a possible replacement might be: (){ ... }, i.e. a table after ()
defines a function. like
(x, y){return x+y}
I do think some Macro feature can accomplish this, i.e. have some
pre-compile step for lua without actually changing lua syntax.
But we obviously should not remove the "return", since lua requires
statements in the function body instead of an expression.
- References:
- (kick,ass): => kick( ass ) ::, Pierre-Yves Gérardy
- Re: (kick,ass): => kick( ass ) ::, Mark Hamburg
- Re: (kick,ass): => kick( ass ) ::, Majic
- Re: (kick,ass): => kick( ass ) ::, Mark Hamburg
- Shorter lambda forms (was Re: (kick,ass): => kick( ass ) ::), James Graves
- Re: Shorter lambda forms (was Re: (kick,ass): => kick( ass ) ::), Majic