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

error: implement general state_type handler #938

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

perazz
Copy link
Member

@perazz perazz commented Feb 17, 2025

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 new state_type base class as part of the stdlib_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 as linalg_state_type: integer error flag, fixed-size character storage for messages and error locations, and type-bound procedures for error checking and reporting. The existing linalg_state_type now extends state_type, ensuring consistency - and interoperability.

The linear algebra modules still require type(linalg_state_type) outputs. We could make them class(state_type), optional, intent(out), so they would seamlessly handle both derived types. However, in Fortran, polymorphic arguments cannot appear in pure procedures, so another alternative would be to template them with fypp.

cc: @jvdp1 @jalvesz @fortran-lang/stdlib

Copy link
Member

@jvdp1 jvdp1 left a 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>
@perazz
Copy link
Member Author

perazz commented Feb 19, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants