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,919 of 117,927   
   sjack to All   
   Toad using many vocabularies   
   31 Oct 24 15:13:36   
   
   From: sjack@dontemail.me   
      
   A while ago I reworked all my source to use many vocabularies to test   
   the FigForth vocabulary design. The many vocabularies were not so much   
   to deal with scoping but to break the dictionary search into many smaller   
   paths. I found it not to be much of a problem, but a little awearness of   
   what affects CONTEXT change is essential.   
      
                                  Vocabulary usage demo   
      
      
   ..CURRENT and CONTEXT are WRK    BASE: 10   Latest: FIO   
   -VOC                             \ save original CURRENT   
   FIO                              \ set CONTEXT to FIO   
   open pad/txt/rubyatLI to hdi     \ data input handle   
   create /tmp/foo   to hdo         \ data output handle   
   --   
   -- CONTEXT must be set to FIO in following compile because   
   -- colon start will reset CONTEXT to CURRENT.   
   -- After compile, CONTEXT will still be FIO.   
   --   
   { FIO begin mpad0 512 read dup while write repeat 2drop }   
   {}          \ run anonymous   
   0 close     \ close data input   
   1 close     \ close data output   
   -- See the created file   
   sys cat /tmp/foo   
   LI.   
   The Moving Finger writes; and, having writ,   
   Moves on: nor all thy Piety nor Wit   
   Shall lure it back to cancel half a Line,   
   Nor all thy Tears wash out a Word of it.   
      
   --   
   -- -VOC and +VOC were made to restore CONTEXT to saved CURRENT   
   -- for the benefit of FORGET MARKER and ANEW which require   
   -- CURRENT and CONTEXT to be the same.   
   --   
   +VOC       \ restsore CONTEXT  to original CURRENT   
   {fin}      \ release anonymous memory   
   ..CURRENT and CONTEXT are WRK    BASE: 10   Latest: FIO   
   --   
   -- -VOC saved original CURRENT   
   --  FIO set CONTEXT for open and create   
   --  FIO set CONTEXT in anonymous compile  { ... }   
   --  CONTEXT is still FIO for close   
   -- +VOC restored CONTEXT to original CURRENT   
   --  ( CURRENT never changed in this example )   
      
   -fin-   
      
   --- 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