-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Enoch,

What about the following (real) session log

 > forward: foo
 ok
 > : bar foo ;
 ok
 > bar
 found only forward declaration.
 > : foo ." Hey" ;
 ok
 > bar
 Hey ok
 >

? It declares a forward symbol named foo which is used
in bar. There is a runtime check, whether foo has been
redefined or not. If it hasn't, the first error message
is printed (when calling bar). If foo got re-defined (or
defined, depends on the view point) it will be called.
Furthermore the forwardly declared call to foo in bar
will be replaced with the newly defined foo so the runtime
check will occur only once. And it will erase the flash
only once for every occurance of foo (there is a !i operation)


Another example?

 > forward: foo

   ok

 > : bar foo ;

   ok

 > : baz foo ;

   ok

 > bar

  found only forward declaration.

 > : foo ." I'm number 1" ;

   ok

 > bar

  I'm number 1 ok

 > : foo ." I'm number 2" ;

   ok

 > baz

  I'm number 2 ok

 > bar

  I'm number 1 ok

 > baz

  I'm number 2 ok

 >

The definition of forward: is small (5 lines of forth code), but digs
very deep into internals and is by no means portable to other systems.
Most of the forward:code can be used to implement late binding, with
potentially heavy runtime costs (unless a special wordlist is used).

Matthias

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlLmr4kACgkQ9bEHdGEMFjPH4gCfTg0HBwHNwdx1X5a8LvzsJbRU
1bAAoOM5Ogur4YqdmwB8cnvFBS29owgN
=XrpT
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
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

Reply via email to