Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.lang.forth Subject: Re: QUIT and ABORT Date: Tue, 06 May 2025 06:55:44 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 47 Message-ID: <2025May6.085544@mips.complang.tuwien.ac.at> References: <87bjtn2hct.fsf@gmail.com> <2025May3.072517@mips.complang.tuwien.ac.at> <6973d7bc1d0376ab234a39a3dda82287b7b13450@i2pn2.org> <2025May3.180226@mips.complang.tuwien.ac.at> <2025May4.153331@mips.complang.tuwien.ac.at> <6a9a2b6e873c1b72bdec2c72749ef0aac6f33f42@i2pn2.org> <27193d56a2a0e6a0fe8b5dcb1668dde8bbcd886e@i2pn2.org> Injection-Date: Tue, 06 May 2025 09:12:41 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d951b660fb3dcbf2a4f420f1a274170c"; logging-data="2539039"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JSHb5Z2U4dpO/QiBnLAVV" Cancel-Lock: sha1:yCcm27Yb98ktfgfpfFbV1f8YOz0= X-newsreader: xrn 10.11 Bytes: 3379 dxf 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.html comp.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/