logoalt Hacker News

Someone • today at 9:35 AM • 2 replies • view on HN

I don’t find the article clear on how it fixes things, but I guess that, now

  a op1 b op2 c
is an error if op1 is unequal to op2 and they have the same precedence. Do I see that right?

Also, it seems each operator will have to have a associativity to handle a future operator for exponentiation or (also potential future) custom operators.

Finally, the “What you need to know” section doesn’t mention orelse. Where does that fit in?


Replies

dan-robertson • today at 10:47 AM

The point is that there is no longer a global ‘precedence number’ where the operator with the higher precedence binds tighter. Instead, it is only valid to write your example for some combinations of op1 and op2; other combinations will require explicit parentheses.

Presumably orelse is not in the table because it requires parentheses for any other operator.

➕ show 1 reply