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 117,001 of 117,927   
   Hans Bezemer to albert@spenarnc.xs4all.nl   
   Re: "Back & Forth" - Local variables   
   08 Jan 25 13:48:11   
   
   From: the.beez.speaks@gmail.com   
      
   On 08-01-2025 12:55, albert@spenarnc.xs4all.nl wrote:   
   > You are optimistic that these programs now are interpreted   
   > by 4th.   
   > If it came from Marcel Hendrix you would be obliged   
   > to get rid of '--' comment signals and that may bit be the end of it.   
      
    From "Forth 2012":   
   "All text between `--' and `:}' is ignored. This eases documentation by   
   allowing a complete stack comment in the locals definition."   
      
   So whether you do "-- :}" or just ":}" it doesn't really matter. It can   
   handle that.   
      
   > I took a different approach.   
   > The lisp implemented for gforth was infested with locals.   
   > This transform LOCALs to VALUEs.   
      
   I'm not sure replacing local variables with global variables is exactly   
   what I mean. I mean "using the stack". I got myself an integer BASIC   
   interpreter where the data stack is actually used as a calculator stack   
   by the interpreter:   
      
   : arith                                \ map operators to words   
      case   
        [char] < of < ;endof               \ less-than operands   
        [char] > of > ;endof               \ greater-than operands   
        [char] = of = ;endof               \ compare operands   
        [char] # of <> ;endof              \ not equal operands   
        [char] - of - ;endof               \ subtract operands   
        [char] + of + ;endof               \ add operands   
        [char] * of * ;endof               \ multiply operands   
        [char] / of / ;endof               \ divide operands   
        [char] % of mod ;endof             \ modula operands   
        [char] ^ of 0 max ** ;endof        \ exponent operands   
      endcase   
      
      
   And no, they're not secretly accumulated in another data structure and   
   then dumped right before the "moment suprème".   
      
   Hans Bezemer   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

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


(c) 1994,  bbs@darkrealms.ca