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

Should set_value/error/stopped CPOs require that member-functions return void? #323

Open
lewissbaker opened this issue Feb 4, 2025 · 2 comments
Assignees
Labels
bug Something isn't working design P0

Comments

@lewissbaker
Copy link
Collaborator

The set_value, set_error and set_stopped CPOs all all currently defined as expression equivalent to a call to the corresponding member function on the receiver, mandating that the call-expression is nothrow.

There is, however, no constraint here to require that the expression is void.

As the specification currently stands, it would be valid to define a receiver with a set_value() method that returned bool, or indeed any other type, and this would still be a valid implementation of a receiver, and the CPO would need to return whatever value the member-function returned.

I wonder whether we'd be better off here requiring the receiver methods to return void so that we reserve future design space for possibly adding semantics to receiver methods that return non-void in future?

@inbal2l
Copy link
Collaborator

inbal2l commented Feb 4, 2025

I don't see downsides for adding such limitation (might save room for defining extended error / status handling in the future?).
@ericniebler @RobertLeahy - WDYT?

@lewissbaker
Copy link
Collaborator Author

Note that the same is currently true of the start CPO.
start(op) is merely defined as expression-equivalent to MANDATE-NOTHROW(op.start()).

It doesn't place any requirements on the return-value.

@lewissbaker lewissbaker added bug Something isn't working P0 design labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working design P0
Projects
None yet
Development

No branches or pull requests

3 participants