Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!seismo!rochester!ritcv!cci632!rb From: rb@cci632.UUCP (Rex Ballard) Newsgroups: net.lang.forth Subject: Re: Some major drawbacks of Forth Message-ID: <166@cci632.UUCP> Date: Wed, 2-Jul-86 11:04:20 EDT Article-I.D.: cci632.166 Posted: Wed Jul 2 11:04:20 1986 Date-Received: Fri, 4-Jul-86 07:44:27 EDT References: <142@obelix.UUCP> Reply-To: rb@ccird1.UUCP (Rex Ballard) Organization: CCI, Rochester Development, Rochester, NY Lines: 70 Summary: Unconventional solutions to common problems. In article <142@obelix.UUCP> ulf-d@obelix.UUCP (Ulf Dahle'n) writes: >I am myself a kind of Forth fan. I implemented a version of Forth on >a small Swedish micro and during that work I got to understand some >of the major problems with Forth. > >First one asks oneself if Forth has an interactive environment or not. >When developing programs you can easily try the just-gonna-see-if-it-works >method. Define a new word, test it, redefine it, forget it all. One version I worked with had a customized feature where the TIB was sent to a buffer, but only definitions were sent. Also, "forget" came in a second flavor which would cause the buffer definition to be forgotten too. When you had a definition you liked. You could save it to a screen for commenting and editing. As I recall, this feature required about 4 screens of packed forth. It's been about six years since I've used it, but it wasn't too hard to do. >But when it comes to editing you have a problem. You don't "decompile" >a definition just like that. You can't "really" replace an old definition. >You are forced to work with a disk-based editor and with "screens". >I tried to construct a prettyprint function that should be able to >recognize BEGIN-UNTIL, IF-ELSE-THEN, BEGIN-WHILE-REPEAT etc. That's hard, >but it can be done. The problem is that all these structures can't be >found in the code, just a bunch of BRANCHs and 0BRANCHs (conditional and >non-conditional jumps). Again, in a customized version, the token names were preserved, with the Branches and 0branches replaced by their source equivilents. Except for a few special cases, it was not too difficult to get real source back. >Another odd thing about Forth is the notion of screens. Why screens? In >my own implementation of Forth I used ordinary text files, which could >be produced by some text editor. Screens use up disk space, they are >a problem when transferring programs. Screens were originally used so that forth could be run from cassette tapes (in fact some forths still do work with tapes). It can be quite trivial to create indexed screens, or use normal files. Many forth programmers actually prefer the "screens", but don't insist that a screen be exactly 1024 bytes, space filled. Many forth installations have real editors written in forth, that can use newline terminated files. The main trick is to replace the lexical "space only" parser with a "white space" parser. It is unfortunate, but true, that many of the cures to the disadvantages of forth exist, but are proprietary, seldom sold or published, and are looked on by "forth purists" as "another language". When the '83 standard was being written, one of the big issues was whether STLs and DTLs were "really forth". In fact, many companies sold "forth-like" STLs which were compatible, but not "true '79". Many purists in the bunch wanted "100% compatibility", at the other extreme, many wanted only the "fig primitives" and "if it looks like forth it is forth". The '83 standard basicly specified standard kernal, and standard extensions. Certain definitions like CFA, NFA, and PFA had to be defined, but could be implemented any way desired, so long as it appeared to give the same result. The politics of the '83 commitee says a lot about the forces behind the language, and the future of the language. Look through the various proceedings, look at the byproducts that have been based on forth, but are not even "standard extensions". Things like parameter passing, automatic variables, static variables, heirarchal organization, classes, and typing have been done, but are often only used in "other languages", many of which still have a forth kernal at their heart.