Base trait for classes that represent capabilities in theobject-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 theLabel class inscala.util.boundary. It represents a capability in the sense that it gives permission tobreak to the enclosing boundary represented by theLabel. It has a scoped lifetime, since breaking to aLabel after the associatedboundary was exited gives a runtime exception.
Capability has a formal meaning whenCapture Checking is turned on. But even without capture checking, extending this trait can be useful for documenting the intended purpose of a class.