Object Ref

From Erights

(Difference between revisions)
Jump to: navigation, search
m (bad colon)
(Protocol: add resolution/1, fulfillment/1)
Line 6: Line 6:
== Protocol ==
== Protocol ==
{{XXX|completely specify and test behavior}}
{{XXX|completely specify and test behavior}}
 +
 +
{{instance msgdoc|resolution|1|<var>ref</var> :[[any]]|[[any]]}}
 +
 +
Observably, this operation returns <var>ref</var> or something indistinguishable from it. If applicable in the implementation, if <var>ref</var> is a forwarder such as a resolved promise, it will return the referent, and any other such applicable optimizations.
 +
 +
{{instance msgdoc|fulfillment|1|<var>ref</var> :[[any]]|[[any]]}}
 +
 +
Requires that <var>ref</var> is [[fulfilled]].
 +
 +
If <var>ref</var> is
 +
* [[fulfilled]] (resolved and not broken), then <code>Ref.fulfillment(<var>ref</var>)</code> returns <code>[[#resolution/1|Ref.resolution]](<var>ref</var>)</code>.
 +
* a [[promise]] (unresolved), then <code>Ref.fulfillment(<var>ref</var>)</code> throws indicating this. {{XXX|Specify exception type?}}
 +
* [[broken]], then <code>Ref.fulfillment(<var>ref</var>)</code> throws its problem.
{{instance msgdoc|promise|0||[[Tuple]]<nowiki>[</nowiki>[[Promise]], [[LocalResolver]]]}}
{{instance msgdoc|promise|0||[[Tuple]]<nowiki>[</nowiki>[[Promise]], [[LocalResolver]]]}}

Revision as of 14:56, 2 July 2009

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

? Ref
# value: Ref

Contents

Protocol

XXX completely specify and test behavior

resolution/1

Signature: resolution(ref :any) :any

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.

fulfillment/1

Signature: fulfillment(ref :any) :any

Requires that ref is fulfilled.

If ref is

  • fulfilled (resolved and not broken), then Ref.fulfillment(ref) returns Ref.resolution(ref).
  • a promise (unresolved), then Ref.fulfillment(ref) throws indicating this. XXX Specify exception type?
  • broken, then Ref.fulfillment(ref) throws its problem.

promise/0

Signature: promise() :Tuple[Promise, LocalResolver]

The specification for this message has not been written.

broken/1

Signature: broken(problem :Exception) :broken

The specification for this message has not been written.

# Regression test
? Ref.broken(null)
# problem: <NullPointerException: Missing problem>
This page is a stub; it should be expanded with more information. If doing so, check the original E web site and the mailing list archives for content which could be moved into this page.
Personal tools
more tools