home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,749 of 117,927   
   Hans Bezemer to Anton Ertl   
   Re: Avoid treating the stack as an array   
   17 Sep 24 12:18:38   
   
   From: the.beez.speaks@gmail.com   
      
   On 16-09-2024 18:26, Anton Ertl wrote:   
   > That, too, but the elimination of the ELSE has more weight with me.   
   >   
   > : WORD1 {: x1 x2 -- :}   
   >    ... ( f ) if ( )   
   >      ... x1 ... x2 ...   
   >    then ;   
   >   
   > : WORD2 ( x1 x2 -- )   
   >    ... ( f ) if ( x1 x2 )   
   >      ...   
   >    else   
   >      2drop   
   >    then ;   
   >   
      
   You mean - like this?   
      
   : WORD2 ( x1 x2 -- )   
       ... ( f ) if ( x1 x2 )   
         ...   
         exit   
       then 2drop ;   
      
   > Forth has a special word ?DUP for one specific variant of this   
   > situation, but it helps only in specific cases.   
   That's one of the reasons I don't like it - and don't support it   
   natively. The horror of returning two different stack diagrams..   
      
   I loved it when I introduced ;THEN. When doing short words, it allowed   
   the 4tH optimizer to kick in and make not one, but *TWO* tail call jumps.   
      
   Hans Bezemer   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca