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

Add a version for response promises that accept an expected #1769

Open
Neverlord opened this issue Feb 23, 2024 · 0 comments
Open

Add a version for response promises that accept an expected #1769

Neverlord opened this issue Feb 23, 2024 · 0 comments

Comments

@Neverlord
Copy link
Member

The idea is to support something like self->mail(foo).request(bar, 1s).then([](expected<my_type> res) { ... }). If foo is statically typed, we also could infer the type to allow self->mail(foo).request(bar, 1s).then([](auto res) { ... }).

I do have a POC for this, but I'm not happy with it. There's a lot of guessing and meta programming indirections involved that make it rather hard to see what's going on, since the implementation has to fall back to the "regular" code if the handler does not take an expected. A way around this could be to have a separate name, e.g., then_ex, to reduce the complexity of the implementation. Won't be as nice, but at least the user would explicitly opt-in to the alternative implementation.

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

1 participant