Liste des Groupes | Revenir à cl forth |
On 2025-05-18 18:27, dxf wrote:On 18/05/2025 6:16 pm, Ruvim wrote:...>
Note that in `error` you don't transfer control to `(abort)` only in the case of `-56`.
I transfer control to (abort) except in the case of -56 where it passes to (quit).
Hence, `-56` is a special case in your implementation.
Another question is how are `evaluate` and `included` implemented?>
>
I assume they use `catch`.
INCLUDE uses CATCH , EVALUATE does not.
If any of the following tests fail, then `evaluate` (or `throw`) is not compliant:
t{ 9 s" 1 throw" ' evaluate catch nip nip -> 9 1 }t
t{ char | parse s" 1 throw" ' evaluate catch nip nip| evaluate -> 1 }t
or
9 s" 1 throw" ' evaluate catch nip nip swap . .
char | parse 9 s" 1 throw" ' evaluate catch nip nip| evaluate swap . .
\ both lines shall print "9 1" in a standard Forth system.
Then your Forth system probably shows the following behavior in its terminal:>
>
999 -56 throw
ok 999 <
>
s" 999 -56 throw" evaluate
ok
>
Of course, the first case shows a non-standard behavior.
The first case is correct behaviour for a system that implements a catchable QUIT.
Yes, it can be correct in the sense that it is in accordance with your system documentation. But it is not in accordance with the ANS Forth standard (as well as Forth-2012).
You interpret the reservation of `-56` for `quit` as a provision to make `quit` catchable.
But catchable `quit` is not ANS Forth compliant. And your deviation in the behavior of `throw` is also not ANS compliant.
Les messages affichés proviennent d'usenet.