Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quit empties the exception stack #6

Open
ruv opened this issue Feb 25, 2023 · 0 comments
Open

quit empties the exception stack #6

ruv opened this issue Feb 25, 2023 · 0 comments
Labels
omission An obviously missed item or typo in the document

Comments

@ruv
Copy link
Collaborator

ruv commented Feb 25, 2023

According to the original intention, the word quit in no way returns control to the caller.

Mitch Bradley, who was Vice Chair of the ANS FORTH committee, wrote in 1992 in comp.lang.forth:

the description of THROW says that, in the absence of explicitly-installed CATCH handlers, the behavior is like ABORT which eventually does the function of QUIT. An implementation of QUIT could do a "preemptive CATCH" and still be within the standard. This isn't surprising; a program that calls QUIT cannot expect to ever regain control anyway.

And quit is usually implemented in such a way that it never returns control.

But according to the specification (in Forth-1994 and Forth-2012), it shall return control if there is an exception frame on the exception stack and throw is performed by the user interactively. An example of call quit with an exception frame:

:noname ['] quit catch cr ." return from quit, ior: " . cr ; execute

Such behavior (i.e., a way to return control) was not intended, and usually is not implemented. So, it's an omission in the specification for quit. This specification should be corrected to say that quit empties the exception stack.

See also

@ruv ruv added the omission An obviously missed item or typo in the document label Feb 25, 2023
@ruv ruv changed the title quit shall empty the exception stack quit empties the exception stack Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
omission An obviously missed item or typo in the document
Projects
None yet
Development

No branches or pull requests

1 participant