Liste des Groupes | Revenir à cl forth |
In article <d9149a9d12db559e2720156b315fcfdcdd90e3fe@i2pn2.org>,
dxf <dxforth@gmail.com> 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.
Les messages affichés proviennent d'usenet.