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,375 of 117,927   
   Ruvim to minforth   
   Re: Nested definitions   
   02 Jul 25 13:50:07   
   
   From: ruvim.pinka@gmail.com   
      
   On 2025-07-02 13:02, minforth wrote:   
   > Am 02.07.2025 um 10:53 schrieb Ruvim:   
   >> On 2025-06-24 01:03, minforth wrote:   
   >> [...]   
   >>   
   >>> For me, the small syntax extension is a convenience when working   
   >>> with longer definitions. A bit contrived (:= synonym for TO):   
   >>>   
   >>> : SOME-APP { a f: b c | temp == n: flag z: freq }   
   >>> \ inputs: integer a, floats b c   
   >>> \ uninitialized: float temp   
   >>> \ outputs: integer flag, complex freq   
   >>>   <: FUNC < ... calc function ... > ;>   
   >>   
   >> BTW, why do you prefer the special syntax `<: ... ;>`   
   >> over an extension to the existing words `:` and `;`   
   >>   
   >>    : SOME-APP   
   >>       [ : FUNC < ... calc function ... > ; ]   
   >>       < ... >   
   >>    ;   
   >>   
   >> In this approach the word `:` knows that it's a nested definition and   
   >> behaves accordingly.   
   > Are you sure? gforth test:   
   >   
   > : APP 1 [ : func 2 ; ] func ;  ok   
   > app   
   > *the terminal*:2:1: error: Invalid memory address   
      
   This is not standard, just like `<: ;>`   
      
   My question is why did you introduce `<:` and `;>` instead of extending   
   the `:` and `;` behavior?   
      
   Something like this:   
      
      : ( "name" -- colon-sys )   
        germ ( xt|0 ) \ the current definition xt or 0   
        0= if  0  :  exit then   
        get-current locals-wodlist set-current  :   
      ;   
      : :noname ( -- xt colon-sys )   
        ['] :noname execute-balance 1- n>r 0 nr>   
      ;   
      : ; ( colon-sys -- )   
        postpone ;  ( wid|0 )   
        ?dup if set-current then   
      ;   
      
      
      
   --   
   Ruvim   
      
   --- 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