Resolver

From Erights

(Difference between revisions)
Jump to: navigation, search
(add elib category)
(use new message doc template)
Line 5: Line 5:
== Protocol ==
== Protocol ==
-
=== resolve/1 ===
+
{{instance msgdoc|resolve|1|<var>resolution</var>|void}}
-
resolve(<var>resolution</var>) :void
+
Resolves the promise to <var>resolution</var>, or [[throws]] if it is already resolved.
Resolves the promise to <var>resolution</var>, or [[throws]] if it is already resolved.
-
=== resolveRace/1 ===
+
{{instance msgdoc|resolveRace|1|_|[[Boolean]]}}
-
resolveRace(_) :[[Boolean]]
+
Resolves the promise to <var>resolution</var> and returns [[true]], or returns [[false]] if it is already resolved.
Resolves the promise to <var>resolution</var> and returns [[true]], or returns [[false]] if it is already resolved.
-
=== smash/1 ===
+
{{instance msgdoc|smash|1|<var>problem</var>|[[Boolean]]}}
-
smash(<var>problem</var>) :[[Boolean]]
+
Equivalent to resolveRace([[Ref (object)#broken/1|Ref.broken]](<var>problem</var>)).
Equivalent to resolveRace([[Ref (object)#broken/1|Ref.broken]](<var>problem</var>)).
-
=== resolve/2 ===
+
{{instance msgdoc|resolve|2|<var>resolution</var>, <var>strict</var> :[[Boolean]]|[[Boolean]]}}
-
resolve(<var>resolution</var>, <var>strict</var> :[[Boolean]]) :[[Boolean]]
+
(Deprecated as of 2007-05-30: [[User:Markm]], [[User:Kevin Reid]], and Dean Tribble agree this interface is inferior to resolve/1 and resolveRace/1.)
(Deprecated as of 2007-05-30: [[User:Markm]], [[User:Kevin Reid]], and Dean Tribble agree this interface is inferior to resolve/1 and resolveRace/1.)
Line 27: Line 23:
Resolves the promise to <var>resolution</var> and returns [[true]], or if it is already resolved, returns [[false]] if <var>strict</var> is false or [[throws]] if it is true.
Resolves the promise to <var>resolution</var> and returns [[true]], or if it is already resolved, returns [[false]] if <var>strict</var> is false or [[throws]] if it is true.
-
=== isDone/0 ===
+
{{instance msgdoc|isDone|0||[[Boolean]]}}
-
isDone() :Boolean
+
Returns whether the promise is already resolved.
Returns whether the promise is already resolved.
-
=== gettingCloser/0 ===
+
{{instance msgdoc|gettingCloser|0||[[void]]}}
-
gettingCloser() :void
+
{{unspecified message}}
{{unspecified message}}

Revision as of 02:19, 2 July 2008

A resolver is an object providing the ability to resolve a promise.

A resolver does not allow retrieving the reference to which a promise has been resolved; in E (but not in ref_send), a resolver allows observing whether resolution has occurred.

Contents

Protocol

resolve/1

Signature: resolve(resolution) :void

Resolves the promise to resolution, or throws if it is already resolved.

resolveRace/1

Signature: resolveRace(_) :Boolean

Resolves the promise to resolution and returns true, or returns false if it is already resolved.

smash/1

Signature: smash(problem) :Boolean

Equivalent to resolveRace(Ref.broken(problem)).

resolve/2

Signature: resolve(resolution, strict :Boolean) :Boolean

(Deprecated as of 2007-05-30: User:Markm, User:Kevin Reid, and Dean Tribble agree this interface is inferior to resolve/1 and resolveRace/1.)

Resolves the promise to resolution and returns true, or if it is already resolved, returns false if strict is false or throws if it is true.

isDone/0

Signature: isDone() :Boolean

Returns whether the promise is already resolved.

gettingCloser/0

Signature: gettingCloser() :void

The specification for this message has not been written.

Personal tools
more tools