[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: ideas for lambda syntax
- From: oliver <oliver.schoenborn@...>
- Date: Mon, 8 Apr 2013 21:41:28 -0400
There is not much that I really miss in Lua, but the lack of a short lambda syntax is one that keeps coming back time and again. When the text around an _expression_ is 5 times longer than the _expression_ it encloses, the code gets obfuscated; it should be unnecessary in a language where functions are objects.
The technique (described on the Lua wiki) involving a text string and loadstring function is not adequate; the quotes make it look unnatural, it is jarring; metalua is not an option; and there doesn't seem to be any hooks that would allow me to create a DLL to extend the Lua syntax.
But I know many of you know the compiler intimately; what would be the simplest syntax that would involve the least modification to lua/luac/libs (such as the library that saves/reads bytecode)? Some examples:
The last one seems quite natural fit in Lua, it is akin to table keys (which can be surrounded by square brackets when the string has spaces).
Any input appreciated.