3 ms·
It's not like it's an implementation detail of their parser, it would make the language more difficult to write correctly and still be parsed by any parser, inc
by dmurray 7y ago
It's not like it's an implementation detail of their parser, it would make the language more difficult to write correctly and still be parsed by any parser, including a human reading the code.
- moomin 7y ago100% agree, it just an unfortunate interaction between 1) ?: syntax 2) [] for dereferencing 3) [] for literals 4) ? for null chaining Each of the decisions is correct in isolation, but together they’re a nightmare. Which decision you made first determines what you end up with in the other areas.
- munificent 7y agoExactly right. If I had a time machine, (1) is what I'd fix. The conditional operator syntax has always been pretty hokey and if you just make `if` an expression (along with most other statement forms), you have no need for it.