Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!rochester!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Vectored Execution Message-ID: <1485.UUL1.3#5129@willett.pgh.pa.us> Date: 9 Aug 90 00:18:05 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 45 Category 18, Topic 67 Message 3 Tue Aug 07, 1990 D.RUFFER [Dennis] at 23:03 EDT Re: boris@prodigal.psych.rochester.edu (Boris "cull" Goldowsky) > I've got an application where the definitions of words may be > changed many times, and I'd like the new definition to actually > replace the old one rather than simply being tacked on for future > use. Although, as Mitch mentioned, Forth does not contain any "standard" way to recover space from selected definitions, you can simulate the feature in just about any Forth. Define a "buffer" for each definition that you want to be able to redefine. Something like this: 256 CONSTANT MAX-BUFFER ( -- n P: Largest definition ) : FOO ; MAX-BUFFER ALLOT Note that I do not include the definition header in the FOO buffer. This is to prevent a looping link structure that I can't think of any other way to solve right now. Then you need a way to redefine the word. You could redefine : if you want, but I'll choose a name like this: : REDEFINE HERE ' >BODY DUP H ! ] MAX-BUFFER + HERE < ABORT" Exceeded buffer" H ! ; Of course, this may not work with all Forths, especially those who do already have memory recovery schemes. Also, if you do get the error message, it is likely that you will not be able to recover since the next definition's header has been corrupted. However, if you are just looking for something simple and you don't have a large set of definitions that need to be redefined, this might just suite your needs. I should also warn you that I just typed this in off the top of my head. If you have trouble with it, IT DOES NOT WORK! So don't hold me liable for any damages resulting from its use. :-) DaR ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or dwp@willett.pgh.pa.us