On 3/28/2020 7:06 PM, dwight via cctalk wrote:
RPN is just there to simplify the interpreter and compiler. It takes some
getting used to. Many claim that infixed is more natural but it is clumsy. One
has to come up with a bunch of rules to make work.
A + B * C
multiply B and C an then add A.
C B * A + in Forth
Telling someone to do the calculation:
Take C and B, multiply them together then take A and add it. ( how unnatural is
that )
What if A B and C were not numbers but instead were function and procedures
that returned values. Lets say C turned on a light and returned the current
used. B multiplied it by the line voltage and A was a previous Watt total.
Would you still write it like the first, knowing it would get the right result
because of some order rule?
Of course, in Forth you'd never use A B and C for such names but you could if
you never expected anyone to read it. ( I've seen Forth look like that )
In Forth you always do things left to right. It is much less error prone. Well
written Forth looks like sentences where you are telling the computer what to
do and in what order. Good high level code rarely has SWAP or ROT in it.
I had a friend that was tasked with writing code to do one of the error
correction routines.
He wrote it in Forth and gave it to his manager.
His manager said "There must be a mistake, you have given me the definition of the
code. Where is the code?"
What better complement could a programmer get. I always
ive to get to that level.
Dwight
I feel that Fig-Forth was the best of all the Forth's out there, Other
Forth's kept changing too much from what I felt was a good standard for
16 bit stuff.