Hello Matthias, Matthias Trute <mtr...@web.de> writes:
>> We have two different cases of forward reference use. > > May I got it: You want a method to have forward declarations > that later get incorporated into the code that uses the > forwardly declared word. > > Something like > > foward foo > : bar foo ; > : baz foo ; > :noname bla fupp ; resolve-to foo > > and all occurances of foo are replaced > with a call to the noname: code, and nobody > could even guess that there was once something > called foo. Right? Yes, I am trying to find a Forth-ified way to introduce linkage editor capability into AmForth. An "Edefer" solution is too expensive -- it adds one runtime indirection and costs a non-volatile EEPROM cell. I like (!) your suggestion. A good implementation is not trivial at all. With "good" I mean. for example, forgetting "foo" after it has been resolved-to... Just as usual, the core idea is simple and straightfowrd (as shown below), the general one quite a challenge. Thanks, Enoch. ------------------------------------------------------------------------- \ (one-at-a-time) simple forward reference "linkage editor": variable back&forth \ option 1: create a placeholder for a forward reference ITC : forth& dp back&forth ! -1 , ; immediate \ option 2: create a placeholder for a forward reference XT constant : &forth postpone (literal) -1 , dp 1- back&forth ! ; immediate \ common: forward reference resolver (put anywhere in referenced word) : &back& latest @ back&forth @ !i ; immediate ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel