Path: utzoo!attcan!uunet!shakti!shri From: shri@ncst.ernet.in (H.Shrikumar) Newsgroups: comp.lang.forth Subject: One Closure for myFORTH was Re: CATCH and THROW Summary: One closure syntax is enuff ... Message-ID: <955@shakti.ncst.ernet.in> Date: 26 Sep 90 10:21:52 GMT References: <9009191309.AA25742@ucbvax.Berkeley.EDU> Reply-To: shri@shakti (H.Shrikumar ) Organization: National Centre for Software Technology, Bombay, INDIA Lines: 53 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 ....