Sujet : Re: QUIT and ABORT
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 06. May 2025, 07:55:44
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025May6.085544@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : xrn 10.11
dxf <
dxforth@gmail.com> writes:
On 6/05/2025 3:29 am, Ruvim wrote:
On 2025-05-05 08:11, dxf wrote:
: bar 4 quit ; ' bar catch 6
>
stack is: -56 6
>
This violates `quit` 6.1.2050, because:
- `quit` is not allowed to remove anything from the data stack (in this case, remove 4 from the stack);
- `quit` is not allowed to place anything on the data stack (in this case, place `-56`);
- `quit` is not allowed to interpret the remaining part of the input buffer (in this case, interpret "6" and place 6 on the stack).
>
A caught ABORT does the same:
>
SwiftForth i386-Win32 3.11.9-RC1 01-Sep-2022
>
: bar 4 abort ; ' bar catch 6 .s
-1 6 <-Top ok
That's the correct behaviour of 9.6.2.0670 ABORT, not of 6.1.0670
ABORT [*]. So apparently your system implements 9.6.2.0670 ABORT, which
is compliant with the standard. For QUIT, there is only 6.1.2050
QUIT, and the behaviour your system exhibits does not comply with the
requirements the standard specifies in section 6.1.2050.
[*] I think the standard makes little sense here: It does not give
much of a guarantee what behaviour a program can expect when it ABORTs
(or ABORT"s) while a CATCH is active. OTOH, a program that uses CATCH
can rely on the existence of THROW and therefore avoid the use of
ABORT or ABORT". The only issue is that someone might want to write a
library without relying on the presence of THROW, and instead use
ABORT or ABORT", and then that library is used by a program that uses
CATCH. For ABORT, the program can deal with this problem by defining
: ABORT -1 THROW ;
For ABORT", one can do a similar thing, but that typically loses some
capability.
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/EuroForth 2023 proceedings: http://www.euroforth.org/ef23/papers/EuroForth 2024 proceedings:
http://www.euroforth.org/ef24/papers/