lua-users home
lua-l archive

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

On Thu, Jul 25, 2013 at 9:47 PM, Lorenzo Donati <> wrote:
 This would be the pandora's box of bikeshedding!

Bravo, that's exactly what we wish to avoid!
If Lua gets to have bit infix operators (as I would like to) I hope they will come with corresponding metamethods, thus widening the choice for custom operators, if one really has the need of so many custom operators.

I also think it would be cool, although they needn't look like the C operators - Lua is not a C-derived language. Like Pascal, the infix operators could look like 'xor' and so forth.  And there have been some interesting proposals recently that the standard operators can be suitably defined for convenient and expressive bit twiddling.

Leo is asking for custom lexical elements, however nearly every language has a fixed set of lexemes for efficiency reasons. Infix operators cannot be done using lexical filtering alone, as he realizes. So the token-filter patch and its descendant LuaMacro cannot take us there and the language needs a more generalized _grammar_.  This is going to be a non-starter; many people depend on the Lua _compiler_ being lightning fast, using it in its original role as a data description language.

A preprocessor is then the only acceptable way forward. But a moment's thought reveals that this itself must be a compiler, generating an AST and emitting Lua code (like Moonscript does).  That can be very fast, but it does feel like overkill for implementing  'ch <- a' instead of 'ch:send(a)'.

steve d.