I'm proud of it and thankfull to the Lua/Luajit projects.
LuaJIT 3.0 proposed syntax extensions
71–80 of 170 posts
Re: LuaJIT 3.0 proposed syntax extensions
#72Tangently related but I’ve been deep in Lua recently working on a rust implementation that supports Lua 5.1-5.5 in one Rust Binary https://github.com/ianm199/omnilua . My ultimate goal was to support LuaJIT in Rust as well but this does not make it easier.
For example, what’s the performance like?
Re: LuaJIT 3.0 proposed syntax extensions
#73Earlier quoted context omitted.
Well, I believe there could be some complications with parsing related to the fact that Lua grammar doesn't really requires semicolons between the statements. But other than that, yeah, detecting "if" in the expression position is pretty unambiguous. No idea why most languages went with "cond-expr ? then-expr : else-expr" bracketed syntax instead.
Surely the most likely explanation is familiary from C? But e.g. ml-family languages (like OCaml, F#, Haskell) and Rust just have the *if* expression that has a non-void value. If your language accepts expressions as statements (most do?), then I think that should just be compatible out of the box.
Oh, and Lua most famously does not accept expressions as statements. Which, now that I think of it, would actually evade most of the parsing complications.
Re: LuaJIT 3.0 proposed syntax extensions
#74Is LuaJIT still based on Lua5.1? I wonder why they haven't followed the language spec up to Lua5.5.
Re: LuaJIT 3.0 proposed syntax extensions
#75Re: LuaJIT 3.0 proposed syntax extensions
#76Please don't, inscrutable bitwise operators are an accident of the past even in systems languages, let alone in a scripting language. I'm not against infix operators for bitwise operations, just please spell them out with keywords rather than giving them sigils. Likewise, going from `and` and `or` to `&&` and `||` would be a dispiriting regression. This is something that Zig got right.
[1] https://en.cppreference.com/cpp/language/operator_alternativ...
Re: LuaJIT 3.0 proposed syntax extensions
#77Re: LuaJIT 3.0 proposed syntax extensions
#78Please don't, inscrutable bitwise operators are an accident of the past even in systems languages, let alone in a scripting language. I'm not against infix operators for bitwise operations, just please spell them out with keywords rather than giving them sigils. Likewise, going from `and` and `or` to `&&` and `||` would be a dispiriting regression. This is something that Zig got right.
What kind of person understands and needs bitwise operators but can't easily remember & | ~ and the arrows for shift? It's very little information. The part I'd call a hassle is the different kinds of right shift but you have that same hassle if you use keywords. I like using the and/or keywords for logical operations. Now let's make bitwise look significantly different from that.
This stuff (especially the ternary) are a step backwards. There is just no reason to waste | on a bitwise or that gets used at 1% of the frequency of the standard or. In the future you might have a better use for it (pipeline syntax, sum or union types come to mind in other languages).
I dislike basically everything about these syntax extensions.
Re: LuaJIT 3.0 proposed syntax extensions
#79Re: LuaJIT 3.0 proposed syntax extensions
#80> For compatibility with other computer languages, the following classic Lua operators can be written in a more customary syntax: Why though? What does changing `and` to `&&` actually achieve? Were people confused? Changing the syntax seems very surface level. It's not actually fixing any problems, just making Lua no longer look like Lua. It's not going to help anyone write/learn Lua. It will make everything more com…
> Why though? What does changing `and` to `&&` actually achieve? Were people confused? Also consider AI, that has a greater training base of JavaScript than Lua. So making Lua look more like JS, should improve output and reduce mistakes.