A lot of people at Reddit told me that it resembles SmallTalk, Factor, and Forth. Being someone who started coding in last decade I have only heard the names but never saw the syntax, but true it looks surprisingly similar. I can't really fathom that people actually built stuff in those language (probably better things that we build today)
Postfixes are easier to use, if you know how to use them. They're not only used in programming but also in spoken language:
It is how, in this sentence, the verb works.
It isn't how the verb works, in this sentence.
Sentences that simple are equally understandable using the verb as a postfix or infix. When sentences get longer that changes, though:
It is how, in this sentence, which now has an extra clause, the verb works.
It isn't how the verb works, in this sentence, which now has an extra clause.
In the first sentence, it's clear that the extra clause is something the sentence has, not the verb. The second example has what is called a dangling modifier, which is a clause at the end of the sentence that ambiguously could be describing more than one thing, in this case it could mean that either the sentence has an extra clause or the verb has an extra clause.
The lack of ambiguity also means it takes fewer commands to describe a single operation. For example, in an calculator with infix notation, which is what most people learn, calculating the multiple of four pairs of sums would require the following keypresses:
( 5 + 6 ) x ( 2 + 7 ) x ( 3 + 8 ) x ( 7 + 9 ) =
With an RPN calculator, which has a postfix notation, it would only require these keypresses:
5 Enter 6 + 2 Enter 7 + 3 Enter 8 + 7 Enter 9 + x x x
That's 24 in the first example and 19 in the latter, a reduction of over 20%.
My grandma never really learned how to use a computer and was generally not very good at complex instructions. When she learned to use a calculator, RPN was just as common as postfix notation, and she was able to figure out how to use RPN, but had trouble figuring out postfix notation. Nowadays, schools usually only teach postfix notation, so most students aren't exposed to the easier method, and will have to do extra work, in the short term, to lean it, but it means calculations will require less work, once learned.
tl;dr: Postfix notation is the Dvorak keyboard to infix notation's Qwerty keyboard. The former is easier and faster, but everyone learns the latter. Putting in the extra work to learn the former will save you more time in the long run.
Thanks for the explanation. I don't agree with your point that postfix is easier; maybe it's because most people are not used to thinking in postfix. It can be faster and easier for computers, but we build software for people, and it increases cognitive load on the users.
It might be fewer keystrokes, but I feel for most people, the difference in keystrokes doesn't justify the cognitive load it adds.
I grew up using HP RPN calculators and it was actually easier in the long run. It isn't in the keystrokes either, but because when I was calculating an algebraic expression, I would have to setup a "query plan" in my head on how I would input all the values and then often I could simplify things as I entered them. I got rather good at manipulating algebraic expressions as a result, and it served me well in college.
reply