Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 738 Bytes

delegation.md

File metadata and controls

13 lines (7 loc) · 738 Bytes

Delegation

This is an example of delegation in ocaps.

Delegation is probably the easiest thing in capabiities to understand, as you're passing a reference to another object, either by passing it as a parameter, or through direct assignment.

Note that assigning a capability to a singleton object or to a thread local is not delegation, as you are exposing the capability globally rather than to a specific target.

Delegation is often combined with @ref:revocation, so that the delegated access to the capability can be revoked as necessary.

You can read @ref:Managing Capabilities in the guide for more information.

@@snip Delegation.scala { #delegation }