Resolver

From Erights

(Difference between revisions)
Jump to: navigation, search
(rename Ref (object) for capitalization unambiguity)
Line 5: Line 5:
== Protocol ==
== Protocol ==
-
{{instance msgdoc|resolve|1|<var>resolution</var>|void}}
+
=== resolve/1 ===
 +
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.
-
{{instance msgdoc|resolveRace|1|_|[[Boolean]]}}
+
=== resolve/2 ===
 +
resolve(<var>resolution</var>, <var>strict</var> :[[Boolean]]) :[[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 if it is already resolved, returns [[false]] if <var>strict</var> is false or [[throws]] if it is true.
-
{{instance msgdoc|smash|1|<var>problem</var>|[[Boolean]]}}
+
=== resolveRace/1 ===
 +
resolveRace(_) :[[Boolean]]
-
Equivalent to resolveRace([[Object Ref#broken/1|Ref.broken]](<var>problem</var>)).
+
Resolves the promise to <var>resolution</var> and returns [[true]], or returns [[false]] if it is already resolved.
-
{{instance msgdoc|resolve|2|<var>resolution</var>, <var>strict</var> :[[Boolean]]|[[Boolean]]}}
+
=== smash/1 ===
 +
smash(<var>problem</var>) :[[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.)
+
Equivalent to resolveRace([[Ref (object)#broken/1|Ref.broken]](<var>problem</var>)).
-
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 ===
-
 
+
isDone() :Boolean
-
{{instance msgdoc|isDone|0||[[Boolean]]}}
+
Returns whether the promise is already resolved.
Returns whether the promise is already resolved.
-
{{instance msgdoc|gettingCloser|0||[[void]]}}
+
=== gettingCloser/0 ===
-
 
+
gettingCloser() :void
-
Has no visible effect; used by [[Causeway|causality tracing]]. Claims that something happened such that this resolver is closer to getting resolved.
+
-
[[Category:ELib specification]]
+
{{undocumented method}}
-
[[Category:Protocols]]
+

Revision as of 15:10, 21 April 2007

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

resolve(resolution) :void

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

resolve/2

resolve(resolution, strict :Boolean) :Boolean

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.

resolveRace/1

resolveRace(_) :Boolean

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

smash/1

smash(problem) :Boolean

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

isDone/0

isDone() :Boolean

Returns whether the promise is already resolved.

gettingCloser/0

gettingCloser() :void

Template:Undocumented method

Personal tools
more tools