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,645 of 117,927   
   dxf to Anton Ertl   
   Re: Conditional compilation   
   26 Oct 25 12:03:17   
   
   From: dxforth@gmail.com   
      
   On 26/10/2025 3:02 am, Anton Ertl wrote:   
   > dxf  writes:   
   >> On 25/10/2025 11:51 pm, minforth wrote:   
   >>> Am 25.10.2025 um 13:36 schrieb dxf:   
   >>>> Put the following into a file and then load it:   
   >>>>   
   >>>> 1   
   >>>>   
   >>>> 0 [IF]   
   >>>>   
   >>>> 2   
   >>>>   
   >>>> 0 [IF]   
   >>>>   
   >>>> 3   
   >>>>   
   >>>> [THEN]   
   >>>>   
   >>>> .S   
   > ...   
   >> The implementation ANS-Forth provides in A.15.6.2.2533 leaves a 1 on the   
   stack   
   >> albeit undisplayed.   
   >   
   > Of course there should be a 1 on the stack.  There is nothing that   
   > removes it.  There is also nothing that displays it, so it's not   
   > surprising that it's not displayed.   
   >   
   > When you paste this code in a recent development Gforth, it becomes   
   > pretty obvious what is happening:   
   >   
   > 1  ok 1   
   >   ok 1   
   > 0 [IF] scanning for [THEN]   
   >  scanning for [THEN]   
   > 2 scanning for [THEN]   
   >  scanning for [THEN]   
   > 0 [IF] scanning for [THEN]   
   >  scanning for [THEN]   
   > 3 scanning for [THEN]   
   >  scanning for [THEN]   
   > [THEN] scanning for [THEN]   
   >  scanning for [THEN]   
   > .S scanning for [THEN]   
   >   
   > When you put it in a file and include that, you instead get:   
   >   
   > include zzz.fs   
   > zzz.fs:3:3: warning: unfinished [IF] at end of file ok 1   
   >   
   > The end of the file finishes the [IF] for you in the development   
   > version (it now says "ok", not "scanning for [THEN]", but not in   
   > gforth-0.7.   
      
   Yes.  I assumed the second  0 [IF]  would be ignored.   
      
   What is the correct behaviour for the routine (as given and used in a file)?   
   If an 'ambiguous condition' then either an exception (Win32Forth) or leave 1   
   on the stack (other Forth) would be valid results.   
      
   In the circumstances that led to this post, I received an obscure 'word not   
   found' error - which wasn't helpful at all.  But perhaps all that I can   
   reasonably expect.   
      
   --- 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