Ship

Lexicon · Behavior dictionary

Behavior dictionary

Explicit bundle of operations passed locally (not a global typeclass).

Ship's settled common form is a behavior module:

// Order.shc
module behavior T(struct 'a) {
  compare: fn(left: 'a, right: 'a) -> Ordering;
}

module behavior UserByName: Order(User) { ... }

Canonical behavior uses nominal lookup (Order(User)); non-canonical behavior is an explicit module argument. A plain record of functions can still be useful for very small local APIs, but it is not the main language model for reusable behavior. See behavior modules.