Hello Matthias,

Matthias Trute <mtr...@web.de> writes:
>> Here is my current solution to eliminating defer indirection in simple
>> forward reference cases:
>> 
>> Comments or is this "cookbook grade" :-)
>
> What is the expected output? 

|S|    1|marker ->test
|W|    2|
|S|    3|variable back&forth
|C|    4|\ use forward referenced word 
|S|    5|: forth&  dp back&forth ! -1 ,  ;  immediate
|C|    6|\ use forward referenced xt 
|S|    7|: &forth  postpone (literal) -1 , dp 1- back&forth !  ;  immediate
|C|    8|\ forward refernce resolver (put anywhere in referenced word)
|S|    9|: &back&  latest @ back&forth @ !i  ;  immediate
|W|   10|
|C|   11|\ 1st calling 2nd examples:
|C|   12|\
|S|   13|: first1  ." first1 " forth& ;
|S|   14|: second1  ." second1" &back&  ;
|W|   15|
|S|   16|: first2  ." first2 " &forth execute  ;
|S|   17|: second2  ." second2" &back&  ;

> first1
first1 second1 ok
> first2
first2 second2 ok

> The wording of your new commands didn't help (me)
> either. I tried to refactor it to

We have two different cases of forward reference use.

>  variable fxt
>  : >fxt dp fxt ! -1 , ; immediate
>  : <fxt latest @ fxt @ !i ; immediate
>
> But it is a hidden thing, what the &forth should do.

&forth compiles a place holder for a constant.
forth& compiles a place holder for a threaded code call.

> I had the impression, that a forward declaration could
> be used multiple times, so it should be resolved not
> only once. I do not see anything even nearby in your 
> code.

Please consider this as a "first iteration" of an idea. It just solves
well my immediate problem of having multiple word pairs with mutual
recursion without resorting to multiple Edefer's.

If you like this approach of eliminating defers (at compile time) we can
develop it further. Naming is also temporary, it is influenced by C/C++,
etc.

Regards, Enoch.


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