lua-users home
lua-l archive

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

On Fri, Dec 4, 2009 at 4:32 AM, Doug Rogers
<> wrote:
> But even that might not be true. If 5.2 includes a standard interface
> for token filters, or for the components necessary for Metalua, then
> there will be no more griping about simple syntax mods. We'll just use a
> Lua-only module that provides the syntactic sugar we crave. (Yes, and we
> might suffer the explosion of weird looking "code" seen in the abuse of
> macros or templates.)

Alas, but token filters have their limitations, because they operate
on the purely lexical level. |x|expr involves working out what an
'expr' is just from the tokens!  So Metalua is usually the tool of
choice for this kind of thing.  But there is a middle way; say there
was a new keyword 'lambda', so that we can say lambda(arglist) expr,
then a token filter could easily transform |x| into lambda(x).
Although a little more verbose, lambda involves one keyword, not
three, and is hence less noisy.  'Noise' is usually understood as a
random-looking set of characters (Perl and APL, you bet!) but could be
more broadly defined as anything that makes reading code more
difficult than it need be.  And nothing is taken away by adding such
short cuts, so people can continue to write in an idiom which they
consider to be 'classic Lua'

Statements like 'Lua is a procedural language' do not do it full
justice. Multiparadigm may be a buzzword, but it does apply here. The
functional style allows very elegant expression of common idioms,
which the short form helps.

steve d.