[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: special forms, take two (was Re: A lua version of "amb")
- From: Fabien <fleutot+lua@...>
- Date: Mon, 27 Feb 2012 17:36:04 +0100
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.