-
Notifications
You must be signed in to change notification settings - Fork 179
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
error: implement general state_type
handler
#938
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you @perazz
Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
Thank you @jvdp1 for the review. If you agree, I suggest to wait a bit longer for additional comments, and then merge if none, so we can make more progress on ohters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant @perazz LGTM!
This PR was spun off #904 for clarity.
Because the adoption of a
linalg_state_type
was successful and flexible enough, it is proposed to extend the linear algebra error handling type by introducing a newstate_type
base class as part of thestdlib_error
module.This would provide a unified framework for managing error states across all different modules of
stdlib
, not only linear algebra but also I/O, filesystem and other modules.The
state_type
class has the same contents aslinalg_state_type
: integer error flag, fixed-size character storage for messages and error locations, and type-bound procedures for error checking and reporting. The existinglinalg_state_type
now extendsstate_type
, ensuring consistency - and interoperability.The linear algebra modules still require
type(linalg_state_type)
outputs. We could make themclass(state_type), optional, intent(out)
, so they would seamlessly handle both derived types. However, in Fortran, polymorphic arguments cannot appear inpure
procedures, so another alternative would be to template them withfypp
.cc: @jvdp1 @jalvesz @fortran-lang/stdlib