lua-users home
lua-l archive

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


spir <denis.spir@free.fr> writes:

>    function (x,y,z) (x+y*z)
>
> This avoids the need for both '=' and an 'end' token.
> (I guess "function(...)(...)..." is well a syntax error as of now?)

(function(x,y,z) (print)(x,y,z) end)(3,4,5)

is perfectly legal Lua code.

I find the attempts to squeeze some constructs into coincidentally
existing gaps of the syntax table even less savory than the |x|
jugglery.  At least with the latter, the unsuspecting newby will
_recognize_ a construct that he does not know, unless it is wrapped in
things like map(|| print("and another one")).

Since all arguments against || hold at least equally as well for
shorthands mashed together from existing syntactical scraps, but the
latter are less recognizable as being a shorthand by user and possibly
compiler, I don't think that the search for alternate _syntaxes_ for
this shorthand leads anywhere sensible.

-- 
David Kastrup