Class Sameness
support.sameness, one question each; this class keeps the family's operator names and the signpost.
A type's SAMENESS is its <=> (an ordered type) or its == (an equatable-only type), chosen by the
author. Every other comparison with the type itself (== <> < <= >
>=) is generated from it (IsDerivedComparison, IsGeneratedFromSameness) and #?
goes with it (IsHashCodeOperator). A type's own sameness is DeclaredSameness; what it inherits is
InheritedSameness, through its super CLASS chain NearestSamenessAbove (and, once PRE_IR_CHECKS has
run, NearestSurvivingSamenessAbove). Hand-written or not: IsHandWrittenOperator,
IsExplicitlyDefaulted.
D24 (Steve, 2026-10-20; replaces B18 rule 4): WHERE the sameness is declared, and HOW, decides its reach.
- WRITTEN BY HAND on an ABSTRACT base or a TRAIT (
IsHierarchyWideSameness) it is ONE sameness for the whole hierarchy - sealed: every sub-type inherits it and may not declare its own (E07182,SealedSameness). This is the only way two different concrete types compare (aShapeordering any two shapes by area), and the abstract base or trait is the sort owner (SortOwnerAbove). - DEFAULTED on an abstract base (follow-up Q1), or on a CONCRETE type, it is that type's own: a sub-type may
declare or
defaultits own over all its fields, inherited ones included, and values of DIFFERENT run-time types are never the same -==is false and<=>unset. The compiler puts that run-time-type check in front of every such comparison, hand-written or generated (NeedsRuntimeTypeCheck; Contract 22), and overrides each inherited comparison signature (OverriddenSamenessSignatures). Such a type may mix run-time types (MayMixRuntimeTypes, E07187).
🛑 Whether a <=> can be USED - it survives, a bare ordering is retracted or withdrawn, an ordering is
unavailable (D55, D58) - is ONE question, OrderingAvailability: EVERY use of <=> asks it, never a
second "can this be ordered" predicate (E07620, NaturalOrderQueue, D63). Its retraction step is
RetractWithdrawnBareOrdering, its wording WhyNotOrderable.
🔑 SELF means "any type this type is assignable to" (IsSelfComparison, IsSamenessOperator)
- itself, a super, a trait, Any. A ==(Any) or an override ==(Base) compares the type with
itself as surely as ==(Self) does; treating those as "other types" left the disagreement B18 removes
reachable (Fable review F1). Operators taking a genuinely unrelated type (==(Integer), <(Date)) are
not self-comparisons.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe operators whose presence the type's sameness decides - never added by the baredefault operatorby name in phase 1, only once types are known (OperationFactory.completeSameness). -
Method Summary
-
Field Details
-
SAMENESS_FAMILY
-