-
Notifications
You must be signed in to change notification settings - Fork 907
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
Join 2 (or more) promises with different types #1985
Comments
Not sure of any exact plans, but:
|
So, I created #706 long ago, but it crashed GCC and deeply confused MSVC. But maybe it's time to try again with newer versions of these compilers. Or maybe just on the That said, the functionality tends not to be as useful as you'd expect, because there's usually a simple work-around: just await one promise, then the other:
The only case where this isn't ideal is if you want exceptions thrown by Actually, I kind of wonder if variadic promises still make sense in the age of coroutines. In the old |
In conclusion... this doesn't feel like a pressing need, especially with the advent of coroutines. So I think it's unlikely I'll pick this up anytime soon. If someone really wants to take the old PR and try to update it though, go ahead. |
Unfortunately, the project I am working on stuck at C++17 for now, so no coroutine. It isn't super performance demanding right now, so my workaround is to chain or nest
I thought about this approach before, with |
I would like to join 2 (or more)
kj::Promise
of different type to produce a single promise that fulfills when all promises fulfills and produces a tuple of 2 (or more) elements corresponding to the return value of each promise. So far, there is onlyexclusiveJoin
which fulfills when one of the promise fulfills, andjoinPromises
, which only operates on the promises that returns the same type. I also noticed that there are similar requests of this feature (#452) before, and it has even been implemented, but never merged into any releases. Are there any plan to include this feature? ThanksThe text was updated successfully, but these errors were encountered: