In article , sjack wrote:   
   >sjack wrote:   
   >   
   >Shortly after I posted I recalled that some have an aversion to   
   >the use of macros and the main point of the example code, I   
   >assume, is the use of a hard coded fragment that includes some   
   >variable that can somehow bind to the entry of the word(s) in   
   >which it will be used.   
      
   I like macro's, especially if the return stack is involved,   
   that otherwise prevents factoring.   
   In fact Forth words are macro's, `:I is a word that inlines its   
   code (different from `: ) but it makes no sense to invent weird   
   syntax around it.   
      
   WANT :I >IN   
      
   :I save >IN @ >R ;   
      
   :I restore R> >IN ! ;   
      
   : VARIABLE save NAME ." defining " TYPE CR restore   
    VARIABLE ;   
   : CONSTANT save NAME ." defining " TYPE CR restore   
    CONSTANT ;   
   VARIABLE aap   
   12 CONSTANT mies   
      
   output:   
   defining aap   
   defining mies   
      
   [ :2 :I :F :R fits comfortably in one screen. ]   
      
   >--   
   >me   
      
   Groetjes Albert   
   --   
   Don't praise the day before the evening. One swallow doesn't make spring.   
   You must not say "hey" before you have crossed the bridge. Don't sell the   
   hide of the bear until you shot it. Better one bird in the hand than ten in   
   the air. First gain is a cat purring. - the Wise from Antrim -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|