Proxy

From Erights

Jump to: navigation, search

A proxy is an eventual reference whose behavior is specified by other references.

In current implementations, all eventual references are either primitive promises or proxies, and proxies are the only way to create far references and pipelining remote promises.

Contents

makeEProxyResolver

See [1] for documentation. This protocol is deprecated because clients of it may break sameness by creating proxies with the same identity but different behavior.

makeProxy

The new proxy maker protocol, which is robust and available as a safe import. See [2] and the nearby thread for the discussion of its creation.

FQN (importable): org.erights.e.ref.makeProxy

Methods:

Creates a new proxy. handler is the handler for messages sent to the proxy; resolutionSlot specifies the resolution (see below); far is true if the proxy is to be a Far ref and false for a remote promise.

For a given handler and resolutionSlot,

  • all results of makeProxy.run(handler, resolutionSlot, false) are the same.
  • all results of makeProxy.run(handler, resolutionSlot, true) between which resolutionSlot has not further resolved (as in TraversalKey) are the same.

The resolutionSlot should be a vow for a FinalSlot whose value is the reference to which this proxy resolves. As soon as resolutionSlot is itself resolved, the proxy will turn into its resolution; handler will never again be invoked.

Far proxies may only be resolved to broken references; if the resolution is something else, or if resolutionSlot resolves to something not a FinalSlot, then the proxy will resolve to a broken reference whose (sealed, if applicable) problem indicates that error.

Send and sendOnly on a proxy send the corresponding handle* messages to handler. Ref.optSealedDispatch on a proxy calls handler.handleOptSealedDispatch immediately.

Rationale for resolutionSlot

The old ProxyResolver facility was a Resolver which could resolve the proxy. The problem with this interface is that, since it is imperative, the proxy's total behavior depends on the holder of the resolver and not solely on its components. Therefore, ProxyResolver clients could make two proxies which are allegedly the same but actually differ in behavior (different resolutions). Using a promise to specify the resolution avoids this possibility because promises can be compared.

The reason a promise for a slot containing the resolution is used, rather than a promise for the resolution, is so that the resolution itself being a promise can be distinguished from the resolution not having occurred yet.

ProxyHandler

Protocol for the handler supplied by the client of makeProxy.

Methods:

XXX document these

Personal tools
more tools