lua-users home
lua-l archive

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


I see that the undead "short lambda syntax" troll experiences its monthly revival... :)

Short and curry-friendly lambda syntaxes are idiomatic in functional languages, i.e. languages with little or no side effects: Scheme, ML dialects, Haskell, etc. But mixing a functional programming style with a lot of mutable data is a maintenance nightmare. Lua happens to be built around mutable tables; it would be bad design for the language to encourage functional style.

If you were to introduce cheap, unmutable cons cells as first-class values together with short lambdas, the result might turn out consistent, but it wouldn't be Lua in spirit anymore. It would be an extremely interesting experiment, though (yes I know you can mimic that with metatable hacks; no that's not what I'm talking about).

If a short lambda syntax would significantly reduce your programs' verbosity, you're probably not being hampered by silly language limitations, you're writing bad code in a language you don't understand. It might be almost decent Scheme code, but it's bad Lua code.