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

Return std::result #1267

Open
SetOfAllSets opened this issue May 1, 2024 · 4 comments
Open

Return std::result #1267

SetOfAllSets opened this issue May 1, 2024 · 4 comments

Comments

@SetOfAllSets
Copy link

Instead of returning an empty value on unsupported systems an err could be returned.

@GuillaumeGomez
Copy link
Owner

There is a const to check that. It would make the whole API more annoying otherwise, don't you think?

@SetOfAllSets
Copy link
Author

I think it would make the api safer. Checking whether a string is empty to say the system is unsupported should be done in most cases and making it return an std::result would make users of the library think about that.

@GuillaumeGomez
Copy link
Owner

This would just increase complexity of the API for an information that you can check with a constant. Doesn't sound like a good idea...

@SetOfAllSets
Copy link
Author

This would just increase complexity of the API for an information that you can check with a constant. Doesn't sound like a good idea...

While with a perfect programmer this would be correct, we live in a world with imperfect actors. Rust code and libraries should nudge users towards proper and safe code and I believe this change would do that.

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

No branches or pull requests

2 participants