Examples

This is a series of examples showing capabilities in action using ocaps.

Note

If you are not familiar with capabilities, please read through the guide for a more in-depth explanation.

Imports

All the examples given rely on the following imports:

import ocaps._
import ocaps.macros._

Construction

This section shows creation of capabilities and direct use.

Structural Patterns

This section shows structural patterns that do not change behavior.

Behavioral Patterns

This section shows patterns that change the behavior of capabilities, typically adding side effects or blocking execution completely.

Operational Patterns

This section shows capabilities used together#.

Authorization Patterns

This section shows capabilities in the context of authorization and delegation.

Confinement Patterns

This section shows capabilities being rendered inaccessible or made accessible through a membrane.