4 ms·
Yeah, relying on operator precedence makes for some of the most infuriating to read code.
by yccs27 5y ago
Yeah, relying on operator precedence makes for some of the most infuriating to read code.
- abrudz 5y agoYeah, infix doesn't go well with that. Even traditional mathematical notation ends up being ambiguous because of it. However, if all infix operators are given equal precedence, it all becomes very neat. See APL (https://apl.wiki https://apl.wiki) for an example of that.
- maximus-decimus 5y agoAt the same time Q (which is based on apl) only allows built in functions to be infix because otherwise your code gets unreadable Especially if you also have prefix notation. in `one two three`, are one and two functions using prefix notation or is two an infix function that takes both one ant three as arguments? It's not too bad if you have a small amount of infix functions to remember, but I don't want to second guess everything while reading code.
- mkl 5y agoCode written by people who don't know operator precedence and so put brackets around absolutely everything is significantly harder to read IME. I've seen students end up with "))))))" at the end of a line. Brackets are better as a signal that something unusual's happening.