Path: utzoo!attcan!uunet!zephyr.ens.tek.com!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.lang.forth Subject: Re: Forth Implementation Question Message-ID: <5981@tekgvs.LABS.TEK.COM> Date: 22 Sep 89 16:13:49 GMT References: <8909221311.AA06054@jade.berkeley.edu> Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 34 (My second posting on this topic) After reading Mitch Bradley's posting, I realized that I needed an addenda. I never had to concern myself with garbage collection/compaction in the Forth I was working on. But it is true that in such environments you can't leave raw addresses lying around. This means that @ and ! as we know them are forbidden! But, again, taking the hint from Smalltalk, executing a "variable" could leave an address token on the stack which @ and ! could interpret to to their work. There would have to be indexing @ and ! operations since you could not do integer arithmetic on address tokens. In Smalltalk, roughly speaking, "variables" leave the offset into one of several types of data storarage areas, and there are several different types of @ and ! operations, different ones for each type of storage area. My proposal is more Forth-like, but would still require major rewriting of Forth code. Example: : TYPE 0 ?DO COUNT EMIT LOOP DROP ; would need to be written as : TYPE 0 ?DO DUP I CI@ EMIT LOOP DROP ; \ CI@ is a character indexed fetch since COUNT would no longer be acceptable. And think of all the places where the sequence "COUNT TYPE" occurs! That would need to be replaced with: : COUNT-TYPE DUP 0 CI@ 1+ 1 ?DO DUP I CI@ EMIT LOOP DROP ; Tom Almy toma@tekgvs.labs.tek.com Standard Disclaimers Apply