Posted by phreddypharkus 16 hours ago
I'm proud of it and thankfull to the Lua/Luajit projects.
So shouldn't it have a new name?
Personally im a fan of introducing ternaranary operator in lua. Everyone uses `x and y or z` as a ternanary which i find way more confusing than ?:
obj?.:method(…)In effort to not pollute the github issue, and hopes that the authors read this thread, I will put some of my thoughts here. There are 3 main strengths of Lua: Embeddable, Fast, and Small(easy to learn). I worry some of these changes divert from the last, expanding the language into a more complicated language.
Here is a list of things already implemented in PUC Lua so can be considered safe to add:
● ~ a Bitwise negate
● a & b Bitwise and
● a | b Bitwise or
● a ~ b Bitwise Xor
● a << b Left-shift
● a >> b Logical right-shift
● a // b Floor divide
● break Break statement
Don't get me wrong, I love some of these quality of life changes like: ● Const keyword: changing const from `local a <const> = 42` to `const a = 42` is far better syntax. The bracketed syntax was never a good idea.
● nil-Coalescing and safe navigation are great additions as they are basically macros at the parsing stage.
● Compound assignment is also basically a macro at the parsing stage as well. Lua should already have this honestly.
● Ternary Operator: I *like* it and it will help the stumbling block of the `a and b or c` common pattern already in use. Though I think (like others have stated) the If/then/else syntax would be more inline with the language, similar to ruby and would enable far more emergent behaviour. However it does establish a new pattern that the last value in a block is a return value similar to ruby so I am conflicted about that.
● `continue` it is nicer than a goto and is helpful.
● String interpolation: I honestly don't love lua's concat operator `..` so honestly string interpolation would be a nice to have and a feature of many modern languages. However I do worry about it's effect on parsing performance, and complexity of the language.
● Underscores in numbers: *shrug*
These are great ideas for the language but I would want all lua versions to support them, not just JIT. These are things that I think are a distraction: ● The `and` `&&` and `or` `||`. This just goes in the wrong direction for lua. It is often confusing in ruby (especially because of precedence issues) but also lua is a wordy language. It has `do` `end` blocks instead of brackets. It adds ambiguity for no reason.
● Short form function syntax. Lua does not need this and I am not sure anyone asked for this. Why `a = |x| do ... end` is more helpful than just `a = function(x) ... end` is unclear and would love to hear more about why this is being considered.
● Named varargs: It may be nice, but there is no real reason to add this. If you wanted a name for your varargs you could do `local name = ...` or just use the `args` variable already available in every function.
● Switch/Match/Select Statements: An optimized if/else block works just as well and another expansion of a small language.Edit: meaning he can come back anytime.
I don't want to spam it in repo, so leaving it here: he is kind of a hero doing this work and I (hopefully we) am very grateful for his contribution to this world.