---
library: "bootstrap"
slug: "Trait"
name: "Trait"
ref: "Trait#e415"
hash: "sema:Trait#mh:SHA-256:e415fe6619857f831d831228b5532ea64d4a6a222773c828098f30d36f450b20"
type: "Data Structures"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/Trait"
---

# Trait

Named surface set that implementers must provide

Infrastructure · Data Structures

## 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](https://semahash.org/vocabularies/bootstrap/patterns/Protocol.md), which is a Trait whose exchange must hold between two or more parties, and from [Contract](https://semahash.org/vocabularies/bootstrap/patterns/Contract.md), 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.

## 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.

## Where this came from

—

## Builds on

- [Protocol](https://semahash.org/vocabularies/bootstrap/patterns/Protocol.md) (references)
- [Contract](https://semahash.org/vocabularies/bootstrap/patterns/Contract.md) (references)

## Used by

- [Solver](https://semahash.org/vocabularies/bootstrap/patterns/Solver.md) (references)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: Trait#e415
- Hash: sema:Trait#mh:SHA-256:e415fe6619857f831d831228b5532ea64d4a6a222773c828098f30d36f450b20

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/Trait
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/Trait.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
