From: dxforth@gmail.com   
      
   On 5/05/2025 1:34 am, albert@spenarnc.xs4all.nl wrote:   
   > In article ,   
   > dxf wrote:   
   >> On 2/05/2025 10:16 pm, albert@spenarnc.xs4all.nl wrote:   
   >>> ...   
   >>> I struggled with giving a meaning to QUIT and ABORT.   
   >>   
   >> Me too.   
   >>   
   >>> I arrived at   
   >>> QUIT initialises both stacks and goes interpreting.   
   >>> ABORT only initialises the return stack and goes interpreting.   
   >>>   
   >>> (if there is an exception system, both must initialise that too.   
   >>> I can't think of a QUIT that can be caught and at the same time   
   >>> initialises the exceptions.)   
   >>   
   >> Technically both end an application distinguished only by the fact   
   >> QUIT lets you examine what was on the stack. Presumably this was   
   >> for debugging purposes. For reasons known only to ANS (and maybe   
   >> Mitch Bradley) both were assigned exception codes and thus CATCHable.   
   >>   
   >> As I wanted a fool-proof way of ending a turnkey app for any reason   
   >> I let QUIT do that. That it may leave stuff on the data stack is of   
   >> no consequence to a turnkey. A QUIT is considered by the OS as a   
   >> 'success' whereas as an uncaught ABORT (or other exception) means   
   >> 'failure'.   
   >>   
   >   
   > Interpretation of QUIT as a REPL is IMHO the more useful.   
   >   
   > Look at the end of my turnkey lisp, build with   
   > lina -c lispl.frt   
   >   
   > ---- lispl.frt ------------   
   > ....   
   > "more.scm" lisp-load-from-file   
   > : doit 'ERROR RESTORED lisp-on QUIT ;   
   > ---------------------------   
   > The doit is the entry point of the turnkey.   
   > Forth is morphed into a lisp interpreter and goes repl-ing   
   > according to QUIT.   
   > [ It understand   
   > (define (first-denomination kinds-of-coins)   
   > (cond ((= kinds-of-coins 1) 1)   
   > ...   
   > with surprisingly little modification of the interpreter.   
   > using PREFIX and a revectoring of NAME ('BL WORD' replacement). ]   
   >   
   > You can replace QUIT by EXIT, and the doit would end normally,   
   > with a return code OKAY (0). You can of course leave out the   
   > EXIT, because this is implied at the end of each definition.   
   > Also if you lisped decently, of course, you get OKAY.   
   >   
   > If QUIT is replaced by 19 THROW, it would end with a return code 19.   
      
   Classical QUIT in my system is currently handled by a headerless word   
   I've dubbed (QUIT) . Thus far I've not needed to expose it. OTOH I've   
   not written the type of apps you have. I've no qualms changing things   
   if the need arises. AFAICS classical QUIT (unconditional return to the   
   forth interpreter loop) no longer exists since ANS assigned it a THROW   
   code.   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|