[comp.lang.forth] One Closure for myFORTH was Re: CATCH and THROW

shri@ncst.ernet.in (H.Shrikumar) (09/26/90)

Mikael Patel asks:

mip>> But why use exception in interpret state after all. Do you have an
mip>> example of this, Mitch?

Mitch Bradley replies:

wmb>The classic example is debugging.  When debugging, it is a pain to
wmb>have to remember that there are certain things that you can't just type
wmb>in at the keyboard and have them work the same way that the work inside
wmb>a colon definition.
wmb>
wmb>It is even more of a pain to *explain* to novices why certain things
wmb>don't work.  It is nicer if everything just works. 

   Seconded.

   Both from the stand-point to easy education, as well as being
more consistent. A different "Interpret" and "Compile" mode is not
too different from vi's "command" and "insert" modes.

   To add to wmb's observations about ' and ['], I also dislike "No
DO ... LOOP from Interpret Mode" and things like that. I enjoy UNIX
shell just due to these constructs, and I want them on my system too.
(Write a command, add a pipe or a while... (so-on) .. and when happy
bottle it in a shell-script.)

   The other gripe is the fact that IF ..THEN, DO ... LOOP etc.  are
all sort-a pre-fix-ish. Could that syntax be given a post-fix sugar ?

   I do like PostScript's { } construct, which makes the syntax much
cleaner.

   For a home-brew I am building, I had initially intended to do a 
quick-and-dirty FORTH, but now I am playing with a syntax cleaned up
according to the above.

   I have a feeling that precisely *one* context-free struture, (a
parenthesis, which is the only closure really needed) which *also* is
given lazy-evaluation semantics, (everything else being strict and
immediate) would give me what I want. (Interpret, Compile, block
structure, closures ...). I am experimenting with some example
pieces of code in myFORTH, a prototype of which I have built using
TILE (thanx Mikael Patel).

   Of course, this is non-standard ... but hopefully, I hope, FORTH
will evolve along these lines.

-- shrikumar ( shri@ncst.in )

PS: Now, if I can get myLOOP to be compiled as a tail-recursive
definition with myIF, with the tail-recursion being (trivially)
optimised out by the compiler .... 

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

In <955@shakti.ncst.ernet.in>, shri@ncst.ernet.in (H.Shrikumar) writes:
>    To add to wmb's observations about ' and ['], I also dislike "No
> DO ... LOOP from Interpret Mode" and things like that. I enjoy UNIX
> shell just due to these constructs, and I want them on my system too.
> (Write a command, add a pipe or a while... (so-on) .. and when happy
> bottle it in a shell-script.)

I think the (old) traditional response is that block editting was
supposed to be soooooooo easy that you would edit words in blocks
loading and reloading until you were happy.  It solves the problem of
command histories, and such, raised by interactive control structures.

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