Re:LuaJIT 3.0 proposed syntax extensions
by noelwelsh on Thursday June 25, 2026 @03:38AM
(#48670193)
Exactly. I don't understand why people think the ternary operator is needed when you can just make `if` an expression instead of a statement. It there is no new syntax to learn and `if` just becomes more useful.
[ Parent
| on HN ]
I don't really understand where is this need to compress the logic into where small chunks comes from. In result we get single line of code which has multiple statement conditions, different paths, and it's not possible to grasp in one go.
Other practical example why ternary is bad: Many code-coverage solutions break on ternary because they don't correctly see that one of the branches was missed in tests.
Re:LuaJIT 3.0 proposed syntax extensions
by bruce343434 on Thursday June 25, 2026 @12:57PM
(#48676212)
Because you can deduplicate certain parts of the logic which make the whole thing less error prone, such as
if c
x=1
else
x=2
If I ever want to change x, or refactor this code some other way, its a more brittle process over x=c?1:2The ternary expression also takes up much less space so there is less of an emphasis on it, this can be a stylistic tool in a programmer's toolbox