Path: utzoo!attcan!uunet!ginosko!ctrsol!uakari.primate.wisc.edu!uwm.edu!mailrus!ncar!noao!arizona!midian!ejm From: ejm@midian.UUCP (E.J. McKernan) Newsgroups: comp.lang.forth Subject: Re: Forth Implementation Question Message-ID: <427@midian.UUCP> Date: 21 Sep 89 16:29:46 GMT References: <1715@thumper.bellcore.com> <7972@medusa.cs.purdue.edu> <7990@medusa.cs.purdue.edu> Organization: Midian Electronics, Inc., Tucson, AZ Lines: 33 In article <7990@medusa.cs.purdue.edu>, bouma@cs.purdue.EDU (William J. Bouma) writes: > In article <17623@bellcore.bellcore.com> sdh@wind.UUCP (Stephen D Hawley) writes: > >> Why? You mention two features that this scheme would facilitate. > >> One is forgetting just a word rather than a word and what follows > >> in memory. The other is producing an application without unused > >> code. But you can get both of these advantages in a normal forth > >> without dynamic code movement. All you need is a compaction routine > >> similar to a garbage collector in lisp. > > > >You can't "just foget all the words that aren't used". Forget will eliminate > >everything defined after as well. What if you want to forget something in the > >middle? You're screwed. > > And what is stopping me? It is trivial to write 'forget' so that it > just eliminates one word from the dictionary, and frees just its > memory! Sure this leaves chunks of unused memory interspersed with > valid forth junk, but that is where compaction comes in. > But you've overlooked a small (large? ;-)) problem. If you forget a word that other words have used in their compilation then you must also forget them. Suppose that you've defined FOO. Then you've defined BAR using FOO. You then forget FOO. Later after one of the garbage collection episodes, the code space that was used for FOO may have been used for something else. When you now execute BAR it just might not do what you intended. ----------------------------------------------- E.J. McKernan - Midian Electronics - Tucson, AZ uucp: ...!uunet!arizona!midian!ejm internet: midian!ejm@arizona.edu snail: Midian Electronics 2302 E. 22nd St Tucson, AZ 85713 voice: 602-884-7981