Comment on Scala – The Simple PartsparentComments−jiaweihli12yI'm not sure what you mean by word, but + vs. add() definitely have different levels of cognitive burden:Compare: (a + (b + c)) + d vs. add(add(a, add(b, c)), d)One is arithmetic, the other is polish notation.−dllthomas12yEven polish notation benefits from +, IMO.+ + a + b c dWe can also (with mainstream OO syntax) make add infix and it's still ugly:a.add(b.add(c)).add(d)−lmm12y+ + a + b c dYuck, really? I find that much less readable than "add(add(a, add(b, c)), d)"−dllthomas12yshrug I've probably done more rpn. A huge component of "readable" is "how similar is it to stuff I am used to reading".I do have to read it backward and build the stack, but that's basically intuitive at this point.
Comments
I'm not sure what you mean by word, but + vs. add() definitely have different levels of cognitive burden:
Compare: (a + (b + c)) + d vs. add(add(a, add(b, c)), d)
One is arithmetic, the other is polish notation.
Even polish notation benefits from +, IMO.
+ + a + b c d
We can also (with mainstream OO syntax) make add infix and it's still ugly:
a.add(b.add(c)).add(d)
Yuck, really? I find that much less readable than "add(add(a, add(b, c)), d)"
shrug I've probably done more rpn. A huge component of "readable" is "how similar is it to stuff I am used to reading".
I do have to read it backward and build the stack, but that's basically intuitive at this point.