For expressions I can understand it's harder. But for function calls we already use prefix notation in almost all languages. We just place the parentheneses differently.
print(sin(pow(2, x))) print(sin(pow(2, x)))pow() is a good example, as it was used a lot as an example for operator overloading in, for example, Swift. So instead of
pow(2,x)
you can write 2 ** x
For many people, the latter seems to be more natural, and feels more "built in" on the one hand, but on the other hand having lots of weird combinations of special characters is somewhat unreadable.If you extend infix syntax to named methods, the problem goes away:
2 raisedTo:x
So why is prefix function notation so popular? The only reason I can think of is that it mimics the function notation we learned in school: f(x). And I guess something can be said for separating the function from its arguments.So in a sense I agree with you that the difference is not huge for some expressions, but for me that doesn't solve the mystery, but only shifts it.
Also, infix has the unfortunate problem of requiring operator priorities to parse.
f(2, g(3, 4))
is impossible to misunderstand. 2 f 3 g 4
isn't.(2 f (3 g 4))
which is arguably how most sane engineers would write it.
> which is arguably how most sane engineers would write it
I'm always wary of this sort of statement.