From: hilpert at cs.ubc.ca
---snip---
I'm not really that fond of Forth as one has to mentally track the
stack state as you read the code, but it may be a lack of familiarity
as I haven't used really use it extensively.
Does anyone actually prefer RPN for textual presentation?
Hi
As you probably know, I'm a great fan of Forth. If it is something
I'm doing for myself, I'll take Forth.
It is easier to write and debug.
As for RPN for equations, I don't think I've ever tried to do
algebra in RPN. I'm not sure it would be as intuitive.
Each has its purpose, I see. RPN is much better for description
of what to do. This is what we write programs to do. Describe
what to do to a computer. It just seem more natural for that
purpose.
Othe languages use mixed, like C. For math, it is infixed and
for everything else, it is post fixed. Surely, that can't be natural.
At least LISP is consistant, everything is postfixed. I just have
a problem debugging LISP because I can't follow the order of
operation as easily ( I suspose one does get used to it ).
So, I guess the answer to your question is that I do not
prefer RPN for testual presentation. Even when I comment
Forth code, I will use infixed notation. As an example, I might
write:
: + ( a b - a+b ) + ;
I'm not sure if that is because I was taught infixed first
or because it is better for presentation.
As for keeping track of the stack, I've always felt that what
Forth needed was a better editor that kept a stack picture
on the side showing state of the stack at the cursor. It
would substitute local comments when ever they were
there but otherwise would use the stack picture of that
operation with the current elements.
The only probem I never figured out was how to handle
the case were one intentionally had a variable number
of items returned on the stack. It isn't used often but
when used, it makes sense. Most times, an unbalanced
stack is an error but not always.
Dwight