primitive val Promises[A: Any #share]
new val create() : Promises[A] val^
Create a promise that is fulfilled when all promises in the given sequence are fulfilled. If any promise in the sequence is rejected then the new promise is also rejected. The order that values appear in the final array is based on when each promise is fulfilled and not the order that they are given.
Join three existing promises to make a fourth.
use "promises" actor Main new create(env: Env) => let p1 = Promise[String val] let p2 = Promise[String val] let p3 = Promise[String val] Promises[String val].join([p1; p2; p3].values()) .next[None]({(a: Array[String val] val) => for s in a.values() do env.out.print(s) end }) p2("second") p3("third") p1("first")
fun box join( ps: Iterator[Promise[A] tag] ref) : Promise[Array[A] val] tag
fun box eq( that: Promises[A] val) : Bool val
fun box ne( that: Promises[A] val) : Bool val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/promises-Promises