lua-users home
lua-l archive

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

On Mon, Aug 12, 2013 at 8:27 PM, Javier Guerra Giraldez <> wrote:
compact lambdas are great for passing one-liners as function
arguments, but if you need indentation to write a two-liner, then you
have two different syntaxes for defining functions.

I see what you mean, although once we're writing more than one line in the body, then perhaps it's best we gave it a name ;)

This does not seem a terrible thing - an inline lambda is an _expression_.  Also, if the function argument is at the end, then this style works just fine

someFunction ->
ok, so it's Lua + compact lambdas + easy to call complex
expressions...  it does sound nice, as long as other features don't
spoil the good parts.

They don't have to be used.  For instance, the way for-loops can return values feels arbitrary, and is basicially yet another way to write a list comprehension.  But I'm a fan of the 'for x in *t' short hand....

steve d.