Isn't significant indentation less verbose than Lua's use of `do ... end`?
Isn't significant indentation less verbose than Lua's use of `do ... end`?
if x < 3 then x = 3 end
I actually really like Lua's syntax, though I think a form for short Python-style lambdas would really help (short lambdas are the easiest ones to understand, so I don't see a comprehensibility objection, and Lua's grammar already makes the necessary expression-statement distinction).The Lua ecosystem was seriously damaged by the 5.1>5.2 split for a while since LuaJIT (hence Torch/nginx) and LÖVE both basically stayed with 5.1 and those were major projects that drew people to the language. The other cool unique thing in the Lua ecosystem, the native-widget (Windows/Gtk) IUP toolkit, remains barely known about and never ported to OS X, possibly due to a lack of Mac users in Brazil. Hence the "language without an ecosystem": it didn't happen for no reason, though the willingness to make breaking changes is a reason the language became so popular in the first place.
NB. IUP is still around, but it still doesn't have a Cocoa port.
> a form for short Python-style lambdas would really help
Interesting - many in the Python community feel that its lambdas (particularly the use of `lambda` as a keyword) are too verbose and would prefer something like `x => x+1`. Maybe such an arrow-function syntax is achievable with Python's new PEG parser - I'm fairly sure it couldn't have been supported by the old LL(1) parser.
About lambda syntax, to me it would be far more important to allow multiline lambdas than to have a shorter keyword.
Even Lua has a built-in `math.max` function that works with integers. Maybe it’s Lua’s way of flexing on Go :)
> About lambda syntax, to me it would be far more important to allow multiline lambdas than to have a shorter keyword.
Never going to happen, unfortunately. It’s just not possible within the fundamental rules of Python’s grammar: that statements use significant indentation and expressions do not.
(lambda x: x + 1)
(function (x) return x + 1 end)
For arrow syntax I like this: ((x) -> x + 1)
but reducing the number of keyword characters from 17 to 6 is already a big win.