[comp.lang.forth] Interpret vs. Compile

dwp@willett.pgh.pa.us (Doug Philips) (09/20/90)

In <9009191309.AA25742@ucbvax.Berkeley.EDU>, wmb@MITCH.ENG.SUN.COM (Mitch Bradley) writes:

I agree with your post up to this point.---\
					   V

> The classic example is debugging.  When debugging, it is a pain to
> have to remember that there are certain things that you can't just type
> in at the keyboard and have them work the same way that the work inside
> a colon definition.
> 
> It is even more of a pain to *explain* to novices why certain things
> don't work.  It is nicer if everything just works.  As Forth "catches
> on" here at Sun, I find that teaching and support is becoming more and
> more critical to success.  Right or wrong, people expect things to work
> the same when interpreted and when compiled, and they are confused and
> unhappy when the expection is violated.  (The worst offender is ' vs. ['] ).

I've gone to and fro in my opinion on your point here.  State-smart versus
state-less.  Short-term learning curve versus long-term learning curve.

The question I have at this point is what weight should be given to the
consistency position you cite in your new-user case.  I assume you also
have problems explaining why  IF  THEN    DO  LOOP  and so on also
don't work if interpreted?

I know that this topic is a perennial one, but I can't remember if its
been raised in this particular context:

How do Forth's interpret/compile, pre-fix/post-fix, state-smart/state-less
dualities really impact the learnability of Forth?  And does that really
impact the spread of Forth as a popular language?  (i.e. should we care
a lot or a little about the first question?)

-Doug
---
Preferred:  dwp@willett.pgh.pa.us    Daily:  {uunet,nfsun}!willett!dwp

wmb@MITCH.ENG.SUN.COM (09/20/90)

> How do Forth's interpret/compile, pre-fix/post-fix, state-smart/state-less
> dualities really impact the learnability of Forth?  And does that really
> impact the spread of Forth as a popular language?

Sun desktop workstations have an expansion bus named "SBus".  Each
SBus card is required to have a PROM on it, containing a Forth program
which identifies the board and optionally provides code for accessing
the device during the booting phase.

Mike Saari provides technical support and Forth training for Sbus
developers, most of whom are unfamiliar with Forth, and often even
a little unreceptive.  This week Mike gave a Forth class with over
200 people in attendance.  It is my belief that this represents a
tremendous opportunity for the growth of Forth.

Mike is a strong supporter of interpret/compile consistency.  He gets
pretty tired of explaining  ' vs [']  and  ." vs .(  .  He has bugged
me about it to the extent that I have "fixed" them to work right.  There
was nothing that I could do about ' without violating the standard,
so I changed  [']  to work in either compile state or interpret state.
In interpret state, ['] behaves like ' .  Similarly, I made ." in interpret
state behave  .( .

New users get bummed out when they expect something to work and it doesn't.
Sometimes they give up on Forth.

Mitch

toma@tekgvs.LABS.TEK.COM (Tom Almy) (09/21/90)

In article <1773.UUL1.3#5129@willett.pgh.pa.us> dwp@willett.pgh.pa.us (Doug Philips) writes:
>In <9009191309.AA25742@ucbvax.Berkeley.EDU>, wmb@MITCH.ENG.SUN.COM (Mitch Bradley) writes:
>> The classic example is debugging.  When debugging, it is a pain to
>> have to remember that there are certain things that you can't just type
>> in at the keyboard and have them work the same way that the work inside
>> a colon definition.
> 
>> It is even more of a pain to *explain* to novices why certain things
>> don't work.  It is nicer if everything just works. [...]


>How do Forth's interpret/compile, pre-fix/post-fix, state-smart/state-less
>dualities really impact the learnability of Forth?  And does that really
>impact the spread of Forth as a popular language?  (i.e. should we care
>a lot or a little about the first question?)

I have taught Forth courses to about 120 people, and have an application
program which requires some Forth programming ability from (over the years)
about 20 people.
Postfix has not been a problem for anyone.

In the classes, by far the counterintuitive problem is the use of a decimal
point to indicate a double integer instead of a floating point number. 
Because in the class we spend time on how Forth works, the dualities don't
seem to really matter. But one real problem is that the inability to use
control structures outside of colon definitions makes it harder to
demonstrate how the control structures work.

I've handled the problems with my application user community by modifying
Forth itself. In particular:

1. Executing a control structure starting word when in interpret state
   starts a transient colon definition. The definition is ended when the
   matching termininating control structure word is compiled, then the
   definition is executed and deleted. In this respect the modified Forth
   works like STOIC, which always compiled commands before execution. 
   The distinction between compile and interpret state becomes moot if
   you compile everything.

2. Nobody mentions the awkwardness of the fetch and store operations. I
   supply a more familiar variable and array types (like the "To Solution"
   from an early Forth Dimensions).

3. A period in a number makes it floating point. Commas can be embedded in
   a number for easy readability (try *that* with C!).

Items 1 and 2 make for a pretty bulletproof Forth that recovers from errors
gracefully (I've also worked on error recovery).

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply

dwp@willett.pgh.pa.us (Doug Philips) (09/22/90)

In <9009211313.AA26444@ucbvax.Berkeley.EDU>, wmb@MITCH.ENG.SUN.COM writes:
> 
> Mike Saari provides technical support and Forth training for Sbus
> developers, most of whom are unfamiliar with Forth, and often even
> a little unreceptive.  This week Mike gave a Forth class with over
> 200 people in attendance.  It is my belief that this represents a
> tremendous opportunity for the growth of Forth.

Ok.  What are the chances of getting a "report" on the reception that
Forth got from those programmers.  How many converts?  How many even
more adamently opposed to Forth?  What was the change in attitude, if
any, over the duration of the course?

-Doug
---
Preferred:  dwp@willett.pgh.pa.us	Ok:  {pitt,sei,uunet}!willett!dwp