Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #55897
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Recognizer for strings and ABORT" |
| Date | 2017-03-18 11:24 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2017Mar18.122401@mips.complang.tuwien.ac.at> (permalink) |
| References | <oagfjf$u7g$1@cherry.spenarnc.xs4all.nl> <1e9023d6-6f4e-49a3-ae62-373bcbc30bb7@googlegroups.com> <oahr86$6ne$1@gioia.aioe.org> |
"HAA" <someone@microsoft.com> writes:
>minforth@arcor.de wrote:
>> ...
>> And I am not at all happy with the reference implementation E6.1.2050 in the Forth
>> 200x/16.1 draft which places the runtime of ABORT" to within QUIT. IMO this is a messy
>> quick&dirty solution that should not be recommended this way.
>
>Sometimes standards don't offer the flexibility needed. E.g. for turnkey applications
>I needed a way to differentiate between 'abort to OS with error code' and 'quit to OS
>with no error'. To that end I use ABORT ABORT" for the former and QUIT for the latter.
For leaving the Forth system and returning to the OS, the standard has
BYE (with no error on the systems I tested). Apart from that, exiting
or entering the Forth system has not been standardized yet.
Gforth has (BYE) ( n -- ) for leaving the Forth system with code n.
As for ABORT, ABORT" and THROW, if you called a word from the Forth
command-line, these words throw you back to the Forth command line.
If you call a word from the OS command line (with 'gforth -e "word
..."'), a THROW, ABORT, or ABORT" throw you back to the OS command
line. That behaviour has proved very useful, and I hope that other
hosted Forth systems eventually see the light and work the same way.
>Also QUIT in my system is not trap-able with CATCH (contrary to ANS which assigns
>QUIT a throw code).
While there is a QUIT throw code (-56), I have no idea what its
purpose is. It's obviously not for the word QUIT, which is specified
in a way that does not allow an implementation based on THROW. In
particular, QUIT preserves the data stack.
Also, a standard-compliant QUIT word must not exit to the OS, but
instead start a Forth command-line interpreter. If you want to exit
to the OS, use BYE.
- 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: http://www.forth200x.org/forth200x.html
EuroForth 2016: http://www.euroforth.org/ef16/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Recognizer for strings and ABORT" albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-03-17 11:59 +0100
Re: Recognizer for strings and ABORT" minforth@arcor.de - 2017-03-17 12:39 -0700
Re: Recognizer for strings and ABORT" "HAA" <someone@microsoft.com> - 2017-03-18 10:27 +1100
Re: Recognizer for strings and ABORT" minforth@arcor.de - 2017-03-18 00:48 -0700
Re: Recognizer for strings and ABORT" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-18 11:24 +0000
Re: Recognizer for strings and ABORT" "HAA" <someone@microsoft.com> - 2017-03-19 11:48 +1100
Re: Recognizer for strings and ABORT" minforth@arcor.de - 2017-03-19 07:59 -0700
Re: Recognizer for strings and ABORT" Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-03-18 03:08 -0500
Re: Recognizer for strings and ABORT" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-18 13:21 +0000
Re: Recognizer for strings and ABORT" minforth@arcor.de - 2017-03-18 11:16 -0700
Re: Recognizer for strings and ABORT" anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-18 14:27 +0000
csiph-web