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,571 of 117,927   
   Anton Ertl to Krishna Myneni   
   Re: 0 SET-ORDER why?   
   26 Jun 24 07:49:10   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   Krishna Myneni  writes:   
   >Why is 0 a valid argument to SET-ORDER (from the optional Search-Order   
   >word set)? It can leave a Forth system in a non-recoverable state.   
      
   So what?  There are lots of ways to put a Forth system in a   
   non-recoverable state.   
      
   >Sentences are separated for emphasis: "If n is zero, empty the search   
   >order."  Why?   
      
   Why not?  It's what I would expect from 0 SET-ORDER anyway.   
      
   Is your question: "What potential uses does an empty search order   
   have?" ?   
      
   I have seen postings that suggest to use EVALUATE for converting   
   untrusted input into a number.  There is of course no security   
   precautions in these postings, but at the very least one could empty   
   the search order before the EVALUATE and restore it after the EVALUATE   
   (with the EVALUATE being wrapped with CATCH).  I thought about writing   
   out the source code, but the main things that would demonstrate is how   
   inconvenient GET-ORDER and SET-ORDER with their arbitrary number of   
   stack items are, and how inconvenient the arbitrary number of stack   
   items produced by EVALUATE is.   
      
   Of course, with recognizer sequences, the better way is to use a   
   recognizer sequence that only contains the number recognizers you   
   want, no need to mess with the search order.   
      
   >In kForth (32/64), the sequence   
   >   
   >0 SET-ORDER   
   >   
   >leaves the Forth system in a non-recoverable state, and I have to use   
   >Ctrl-C to break out back to the OS shell. This appears to be true in   
   >Gforth as well, although Gforth traps Ctrl-C, so maybe one has to kill   
   >the process from another shell.   
      
   In Gforth you can leave the text interpreter in the traditional Unix   
   way of doing Ctrl-D at the start of a line.   
      
   Restoring an empty search order to some more usable default by the   
   system CATCH handler would be a potential convenience feature, but I   
   have not experienced an empty search order as a problem yet, and I   
   don't remember users asking for such a feature, either.  And it would   
   only catch   
      
   0 SET-ORDER   
      
   but not the functionally equivalent   
      
   WORDLIST 1 SET-ORDER   
      
   So why nerf one and not the other?   
      
   - 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 2024: https://euro.theforth.net   
      
   --- 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