Capability
Base trait for classes that represent capabilities in the object-capability model.
A capability is a value representing a permission, access right, resource or effect. Capabilities are typically passed to code as parameters; they should not be global objects. Often, they come with access restrictions such as scoped lifetimes or limited sharing.
An example is the Label class in scala.util.boundary. It represents a capability in the sense that it gives permission to break to the enclosing boundary represented by the Label
. It has a scoped lifetime, since breaking to a Label
after the associated boundary
was exited gives a runtime exception.
Capability has a formal meaning when Capture Checking is turned on. But even without capture checking, extending this trait can be useful for documenting the intended purpose of a class.
Attributes
- Experimental
- true
- Source
- package.scala
- Graph
-
- Supertypes
-
class Any
- Known subtypes