| ▲ | LuaJIT 3.0 proposed syntax extensions(github.com) | |||||||||||||||||||||||||||||||||||||||||||
| 60 points by phreddypharkus 2 hours ago | 31 comments | ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | Heliodex an hour ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||
A comment <https://github.com/LuaJIT/LuaJIT/issues/1475#issuecomment-47...> has already been made on the issue regarding the ternary operator, recommending `if x then y else z` over `x ? y : z`. This is exactly how it's done with if-then-else expressions in Luau <https://luau.org/syntax/#if-then-else-expressions>, another language compatible with Lua, and makes it a ton easier to nest (especially with elseif) and I believe still easier to read than `y if x else z`. | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | 3eb7988a1663 an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
Never will I understand ternary operators. As soon as you introduce it, some chuckle heads want to use them everywhere. Worse if the syntax allows nested ternarys. I guess it keeps the language open for code golfing, but it otherwise seems like redundant syntax that at best saves a few characters. | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | ricardobeat an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
I see JavaScript. Some of these really look like QoL improvements. I'm not convinced ternary statements are an ergonomic improvement in particular. The examples given don't make a compelling case, 'visually tidy' is not the same as readable. | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | pansa2 an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
So is LuaJIT resuming active development after a decade or so of only maintenance? Great! A lot of these changes make sense (although some of them are a bit too TIMTOWTDI for my taste) - but perhaps LuaJIT 3 would benefit from a change of name as well? Certainly with all these changes, it would be more like a separate language than merely a JIT-compiled version of Lua. | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | JSR_FDED 10 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
What’s the Lua/LuaJIT story these days for bundling up all the scripts of an application into a single file? Is there a way to do the super convenient go-like thing? | ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | matheusmoreira an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
Looks like LuaJIT is really going to fork away from Lua this time. After these changes, it won't be a compatible Lua 5.1 implementation anymore, it will be a new language. So shouldn't it have a new name? | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | bawolff an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
+= and ..= are things i find i'm constantly missing in lua. 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 ?: | ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | larrry 44 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
I would love to see all of these come to LuaJIT (and love2d to support the new version too). It’s nice that Lua is simple, the syntax changes should hopefully make Lua code even simpler to read too | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | JSR_FDED 14 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
Cool to see this - ergonomic syntax will make it easier to recommend Lua. Hope the PUC team aligns with this. Also, I love this kind of pragmatism: > Exponentiation assignment a ^= b has been deliberately omitted to avoid a predictable pitfall: this is how xor assignment is written in most other computer languages. Also, a syntax for exponentiation assignment is rarely asked for. A ‘defer’ for closing files or deleting temp files at the end of a script will make life more enjoyable. | ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | le-mark an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
I’m confused I thought Mike Pall left luajit and Laurence Tratt took over as maintainer? | ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | kibwen 14 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
Please 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. | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | sourcegrift 16 minutes ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||
What are some pragmatic embedded scripting languages of choice these days if one has to consider: 1) Ease of learning, ideally minimal deviant behaviour (eg i consider lua tables to be a new concept in itself) 2) Reasonably fast. Not as much as lua jit but even half would be good enough 3) Mature 4) Has Rust bindings | ||||||||||||||||||||||||||||||||||||||||||||
| ▲ | linzhangrun an hour ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||
I thought luajit had completely stopped feature updates | ||||||||||||||||||||||||||||||||||||||||||||