0 votes
by dave selby (250 points)
Hello, I am trying to define a word that acts like ." but will call an extra word on execution, i have called it d". I copied the code for ." from the kernel to test but it says it cant find the word compile ? I checked other dictionaries, checked the manual, I am at the limit of my understanding with ndcs and would be most grateful if anyone could help :)
: (d"-run) ( -- )
    \ Runtime action of d"
    r> count  2dup + aligned >r  type
;
: d"
    [char] " word $.  ;
    ndcs: ( -- )  discard-sinline compile (d"-run)  ",  ;

1 Answer

0 votes
by Stephen Pelc (3.4k points)
selected by dave selby
 
Best answer
Use POSTPONE instead of COMPILE. The kernel is cross-compiled and the cross compiler supports COMPILE as well as POSTPONE.
by dave selby (250 points)
Thank you, that works :)
...