Infrastructure · Data Structures
Trait
Named surface set that implementers must provide
Definition
Mechanism
A marker interface: a named set of surfaces a pattern requires of anything claiming it, so a caller can invoke across implementations without knowing which one it holds. A Trait has no instances of its own — it is claimed by other patterns, which supply the surfaces it names. Distinct from Protocol, which is a Trait whose exchange must hold between two or more parties, and from Contract, which is a signed agreement rather than a type claim.
Invariants
- Names the surfaces an implementer must provide, and which of them are mandatory.
- Non-instantiable: a Trait is claimed by another pattern and has no standalone instance.
- Says nothing about how the surfaces are implemented.
Risks
Failure modes
Claimed without provision
a pattern declares the Trait and omits a mandatory surface, so callers dispatch to something that cannot answer.
Surface set widened after adoption
adding a mandatory surface breaks every existing claimant, which is why the set is part of the Trait's identity.
Relationships
Builds on
Used by
References
Mind
Abstract five-surface contract: Manifest, Execute, Consult, Verify, Feedback
Reference
Data schema
{
"type": "object",
"required": [
"surfaces",
"mandatory"
],
"properties": {
"surfaces": {
"type": "array",
"items": {
"type": "string"
},
"description": "Surfaces an implementer must be able to answer."
},
"mandatory": {
"type": "array",
"items": {
"type": "string"
},
"description": "The subset without which a claim to this Trait is void. Solver's is Manifest and Execute of five."
},
"claimants": {
"type": "array",
"items": {
"type": "string"
},
"description": "Patterns declaring this Trait, where the library tracks them."
}
}
}