Object Ref

Ref is an object available in the universal environment which provides the basic operations on refs other than call and send.

? Ref
 * 1) value: Ref

Protocol
Observably, this operation returns ref or something indistinguishable from it. If applicable in the implementation, if ref is a forwarder such as a resolved promise, it will return the referent, and any other such applicable optimizations.

Requires that ref is fulfilled.

If ref is
 * fulfilled (resolved and not broken), then  returns.
 * a promise (unresolved), then  throws indicating this.
 * broken, then  throws its problem.

? Ref.broken(null)
 * 1) Regression test
 * 1) problem: 

Used for the when-catch construct.

If ref never becomes resolved, the reactor is not invoked. Should ref become resolved, reactor will be invoked exactly once. For example, if ref becomes fulfilled and then broken, reactor will hear of exactly one of these events.

Once ref becomes resolved reactor will be invoked with the resolution. Should reactor be invoked with a non-broken value (and therefore a fulfilled value), all earlier messages sent on ref before the whenResolved are guaranteed to have been successfully delivered.

Like whenResolved/2 but without a conventional return result. Use this when you don't care about the return value of reactor.

Should a breakable reference ever become broken, even if it became fulfilled in the meantime, then the reactor is invoked once with a broken reference.

A vat-crossing reference that gets garbage collected before a partition is not broken by that partition, and therefore doesn't need to inform the reactor. Once a reference is logically garbage (unreachable), it may or may not have been collected yet, and so may or may not inform the reactor of partitions that happen after it is garbage.

Returns a promise that will resolve to the outcome of calling the reactor, as explained here. Note that, if ref becomes near, it'll never break, so the returned promise will never be resolved!

Like whenBroken/2 but without a conventional return result. Use this when you don't care about the return value of reactor.