Comment

Comment by ball_of_lint

Most programming languages ought not to be optimized for a non-programmer to read, but rather for someone who writes code to read.

There's a lot of options for a language to deal with a statement like this. It could be a syntax error, a compile or lint warning, it could work by doing order of operations and comparing the boolean from one compare with the third element, or it could work in the way you described.

I'd prefer languages that I work with to chose earlier options from that list. In most languages this sort of statement is usually a bug, and deserves explicit parenthesis to clarify the order of operations. I really don't want to have to pull out an operator precedence chart in order to read your code, much less have to look up some esoterica about this specific language.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton