Skip to content

Promises[A: Any #share]

[Source]

primitive val Promises[A: Any #share]

Constructors

create

[Source]

new val create()
: Promises[A] val^

Returns


Public Functions

join

[Source]

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

Parameters

Returns


eq

[Source]

fun box eq(
  that: Promises[A] val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: Promises[A] val)
: Bool val

Parameters

Returns