Skip to content

Better error handling #6

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

Open
certik opened this issue Oct 16, 2019 · 3 comments
Open

Better error handling #6

certik opened this issue Oct 16, 2019 · 3 comments
Labels
Clause 11 Standard Clause 11: Execution control unsubmitted Has not been submitted to the committee yet

Comments

@certik
Copy link
Member

certik commented Oct 16, 2019

A common request is to improve how error handling is done.

Whether exceptions, or some other mechanism.

@zjibben zjibben added the unsubmitted Has not been submitted to the committee yet label Oct 16, 2019
@zbeekman
Copy link

I often roll-my-own error stack, which is a pain, but let's you pass it in to elemental and pure procedures. It would be nice to have at least a pre-defined object with similar capabilities---something that can carry around state and provenance of errors so that computationally intensive code regions can remain pure/elemental etc. and don't need to interact or abort on errors, but can pass back meta data about when and where an error occurred.

Also, the try...except syntax convention of other languages feels natural and appeals to me.

@milancurcic
Copy link
Member

Relevant: https://j3-fortran.org/doc/year/19/19-224.pdf

I am not convinced that the proposed solution is a step in the right direction. Specifically:

Detection of all exceptions that are identified by enumerators of the type EXCEPTION defined in the intrinsic module ISO_FORTRAN_ENV, is always enabled.

This approach necessarily implies that every statement runs (internally) in an if/then/goto block, a common criticism of try/except in Python, for example. There are many applications (most HPC software) in which exception handling would be preferred to be disabled by the user in production.

Further, the example (Section 6) seems to me as verbose as if it was handled with C-style exception handling, but with new syntax for the programmer to learn.

@certik
Copy link
Member Author

certik commented Oct 17, 2019

@milancurcic yes, the most common objection from the committee is that exception handling like that can easily cause missed optimization opportunities, and thus any proposal that could be put forward should not hamper performance.

The syntax issue you mention is also a problem. Another issue is what kind of exceptions should be handled, and whether floating point exceptions fall in that category.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clause 11 Standard Clause 11: Execution control unsubmitted Has not been submitted to the committee yet
Projects
None yet
Development

No branches or pull requests

4 participants