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 strive to get to that level.
Dwight
________________________________
From: cctalk <cctalk-bounces at classiccmp.org> on behalf of Kevin Monceaux via
cctalk <cctalk at classiccmp.org>
Sent: Saturday, March 28, 2020 12:27 PM
To: General Discussion: On-Topic and Off-Topic Posts <CCTalk at ClassicCmp.org>
Subject: Re: DIBOL and RPG for RSTS
On Sat, Mar 28, 2020 at 06:55:34PM +0000, dwight via cctalk wrote:
There are a few reasons most don't like Forth:
I've looked at a few example Forth programs in the past. I usually cringed
and quickly moved on. I should have done a little more research back then.
This thread inspired me to take a closer look. Once I discovered that Forth
uses reverse Polish notation, I'm intrigued. I was introduced to HP RPN
calculators in high school, and eventually bought my own HP 11C. These days
on Linux I use Orpie, a ncurses full screen RPN calculator.
--
Kevin
http://www.RawFedDogs.net
http://www.Lassie.xyz
http://www.WacoAgilityGroup.org
Bruceville, TX
What's the definition of a legacy system? One that works!
Errare humanum est, ignoscere caninum.