Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.lang.forth Subject: Re: Nuke separate CONTEXT and CURRENT Message-ID: <7216@tekgvs.LABS.TEK.COM> Date: 29 Mar 90 23:27:56 GMT References: <9003290449.AA13492@jade.berkeley.edu> Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 82 In article <9003290449.AA13492@jade.berkeley.edu> wmb@MITCH.ENG.SUN.COM writes: >I wrote: >> My personal preference is a vocabuary stack. > >ALSO/ONLY/PREVIOUS is a stack with the PUSH/POP operations factored >strangely (presumabley for historical compatibility). And *that* is why I don't like ALSO/ONLY! >> A typical COMPOPS word (from memory): >> >> COMPOPS DEFINITIONS >> >> : 1+ \ native code compile time definition of 1+ >> FORTH \ make context FORTH again. > >But note that you had to explicitly execute FORTH after defining the >new word anyway. If CONTEXT and CURRENT were the same, your example >would be even simpler, because DEFINITIONS would not be needed: > > COMPOPS > : 1+ \ native code compile time definition of 1+ > FORTH \ make context FORTH again. If the COMPOPS vocabulary had defining words (as it happens, it doesn't) then this might not work because the colon would be the one in COMPOPS rather than the one in FORTH. On the other hand, the definition would be simpler if colon didn't do the CURRENT @ CONTEXT ! operation. Then I could say COMPOPS DEFINTIONS FORTH and have a string of definitions without having to change vocabularies at all. >(Actually, neither of these is strictly correct in Forth 83, because >vocabulary names are not immediate, as they are in Forth 79. That's what I get for a quick from-memory hack. I reality I define : FT FORTH ; IMMEDIATE and use this in the definitions. >> >How about historical arguments? >> Sure. This is the way it has always been done. >I was hoping to hear some reasons why it was done this way Well CURRENT --> where to put new definitions CONTEXT --> where to look for words Two separarate, distinct functions IMHO. I've heard an explaination for the CURRENT @ CONTEXT ! deal in colon, but I forget it (I certainly didn't agree with it). >> I'm happy with the status quo. >Unfortunately, the status quo is that there are n different styles of >vocabulary creation and search order specification. Offhand, I can >think of the following important systems, each with different handling >of vocabularies and search order: Well the 83 Standard was so wishy-washy along these lines that just about any approach would meet the standard (fig, 79, even STOIC, but not necessarily ALSO/ONLY!). You simply had to search CONTEXT first and FORTH last, and anything else was fair game. > FIG/Forth 79 (vocabulary trees) Actually the 79 standard required that vocabularies be sealed. The search order was CONTEXT then FORTH. > LMI (VOCABULARY takes a numeric argument (I think)) Nope, but vocabularies are internally sequentially numbered and effectively become part of the name field. Words are not sequentially linked but are accessed throught a large hashing table. >All of these vocabulary schemes have problems of one sort or another. How true! Tom Almy toma@tekgvs.labs.tek.com Standard Disclaimers Apply