pnoltes commented on a change in pull request #272:
URL: https://github.com/apache/celix/pull/272#discussion_r457657591
##########
File path: misc/experimental/promise/api/celix/Deferred.h
##########
@@ -136,12 +139,81 @@ namespace celix {
* the specified Promise. The returned Promise will be resolved with a
failure of IllegalStateException if the
* associated Promise was already resolved when the specified Promise
was resolved.
*/
- //TODO support void promises
- //Promise<void> resolveWith(Promise<T> with);
Review comment:
A Promise<void> can be used as way to see if something is done (ok or
nok (onResolve on onFailure).
The use case for resolving a void promise with a typed promise is (IMO) if
you are not interested in the result downstream, but use want to use the
promise as a sync.
So for example you get Promise<double> from some function (maybe 3rd party)
where the double is the time it took to process, but in "our" API we just want
to indicate whether were a done (success or failed). In this case you can
create a Promise<void> and resolve it with the Promise<double> (regardless if
the Promise<double> is already resolved or not)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]