Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.lang.forth Subject: Re: Interpret vs. Compile (was: CATCH and THROW) Message-ID: <8157@tekgvs.LABS.TEK.COM> Date: 21 Sep 90 15:29:21 GMT References: <9009191309.AA25742@ucbvax.Berkeley.EDU> <1773.UUL1.3#5129@willett.pgh.pa.us> Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 52 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