Hacker News new | ask | show | jobs
by pron 16 days ago
Maybe it will add that. But just how important that is, though, I'm not so sure. Languages like Java, C, and Go don't currently offer custom infix operators, and they are more popular than many languages that do.

Note that there are some complexities, though, to infix operators regarding the order of operations (e.g. + vs * in ordinary mathematical notation) and associativity (e.g. is `(x <+> y) <+> z` equal to `x <+> (y <+> z)`?). They can be dealt with, of course, but not without adding complexity that may or may not be worth it.

1 comments

Just require parenthesis
You could certainly require parentheses, but it's not a "just", because infix operators are desirable in the first place for readability, and requiring to write something like `((((((a + b) + (c * d)) + e) + f) + g)` significantly reduces that advantage.