pharo-contributions / taskit

TaskIt is a library that ease Process usage in Pharo. It provides abstractions to execute and synchronize concurrent tasks, and several pre-built mechanisms that are useful for many application developers.
MIT License
43 stars 24 forks source link

Is there an existing way to use futures like JS Promise.all()? #73

Closed psvensson closed 3 years ago

psvensson commented 4 years ago

In JavaScript promises, there is a static method called all(), which takes an array of promises/futures and returns a future which resolves into an array with all of the results from the input futures.

I have written my own small implementation which I'd be happy to contribute, but first I'd like to know if it is already implemented and I'm just too dense to understand the docs :)

sbragagnolo commented 4 years ago

I would like to see the implementation, like that i can tell you better. I am not sure if i completly understand. Normally i would do a collect of the collection, or an inject into + zip: . But i am not sure if i completely understand. So, point me to hte code i can review and give feedback

psvensson commented 4 years ago

Hi, OK. Hmm, maybe collect is what I'm looking for, but the documentation is so vague about what is actually happening. In JavaScript, Promise.All takes an array of promises/futures and returns a new promise, which will be resolved or rejected when all the promises in the array have resolved (or one or more rejected).

On Fri, Mar 27, 2020 at 1:25 PM Santiago Bragagnolo < notifications@github.com> wrote:

I would like to see the implementation, like that i can tell you better. I am not sure if i completly understand. Normally i would do a collect of the collection, or an inject into + zip: . But i am not sure if i completely understand. So, point me to hte code i can review and give feedback

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sbragagnolo/taskit/issues/73#issuecomment-604971384, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAJVAXL24YRDTEXA7KLTQLRJSLKBANCNFSM4KK23TJQ .

-- Peter Svensson

http://se.linkedin.com/in/petersvensson (LinkedIn) http://twitter.com/psvensson (@psvensson)

tinchodias commented 3 years ago

This can be closed with #80 Please reopen it if I'm wrong.