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,394 of 117,927   
   Anton Ertl to Ruvim   
   Re: Nested definitions   
   03 Jul 25 08:34:26   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   Ruvim  writes:   
   >On 2025-07-02 19:12, Anton Ertl wrote:   
   >> The benefit of defining a normal colon definition inside another colon   
   >> definition eludes me, however.  Maybe mutual recursion, but the need   
   >> is rare and deferred words handle that well.   
   >   
   >As I can see, the idea is that the name of a nested definition has the   
   >limited scope — the same as a local variable, and it is not visible   
   >outside of the containing definition.   
      
   I have found the limited scope to be a hindrance, not a help: When I   
   want to debug, I want to call the word, but if it is not visible,   
   that's hard.  There is a compromise: The scope recognizer allows to   
   invoke a word X in a vocabulary V with the syntax V:X:   
      
   vocabulary foo  ok   
   also foo definitions  ok   
   create foo1  ok   
   previous definitions  ok   
   foo1   
   *the terminal*:9:1: error: Undefined word   
   >>>foo1<<<   
   Backtrace:   
   kernel/recognizer.fs:89:21:              0 $7FCA47A12FF8 throw   
   foo:foo1 hex. \ output: $7FCA47AA0DE8  ok   
      
   - anton   
   --   
   M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html   
   comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html   
        New standard: https://forth-standard.org/   
   EuroForth 2023 proceedings: http://www.euroforth.org/ef23/papers/   
   EuroForth 2024 proceedings: http://www.euroforth.org/ef24/papers/   
      
   --- 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