Package org.ek9lang.compiler.support.sameness
package org.ek9lang.compiler.support.sameness
-
ClassDescriptionThe fields a generated
<=>walks for one type: its properties and, for a dynamic class, its captures (GeneratedOperatorFields; D62 - a capture is a field, not a property).The nearest concrete<=>above the type that compares its level with itself, read from the methods as DECLARED - a retracted one included (getAllNonAbstractMethodsInThisScopeOnlydoes not filter the retraction), soOrderingAvailability.orderingSurvives(MethodSymbol, ISymbol)gives the same answer whichever types phase 5 has already visited.The concrete<=>this one LEVEL declares comparing itself with itself, read as DECLARED (a retracted one included), preferring the one taking exactly the level.THE sameness a type itself declares (B18) - its own non-abstract<=>comparing it with itself, else its==- hand-written or defaulted, never one GENERATED from it (IsGeneratedFromSameness).THE "did the developer write an==that takes the type itself" (not a defaulted one).THE "has the aggregate its own REAL<=>that takes itself" - hand-written, or defaulted (and not retracted) over fields that can all really be ordered.THE sameness a type INHERITS - from its super chain (stopping beforeAny) or any of its traits (its own, a super's, a trait's trait) - if any, sealed or not.THE "is this a comparison B18 generates from the sameness?": a<><<=>>=comparing the owner with itself (IsSelfComparison) - always generated, never written.THE "is this an explicitdefault operator X", as opposed to one added by the baredefault operatoror one generated from the sameness (IsGeneratedFromSameness).THE "is this a comparison GENERATED from the type's sameness" (B18 - never written or requested).THE "did the developer write this operator's body" (notdefault operator) - the sameness rules' meaning of hand-written (B18, D24).THE "is this the zero-argument#?" - the hash code that goes with a type's sameness (B18).THE "is the sameness this type declares ONE sameness for its whole hierarchy?" (D24 rule 1).THE "is this a declaration of its owner's sameness?" (B18): a<=>or==comparing the owner with itself (IsSelfComparison).THE "does this operator compare its owner with ITSELF?" of B18 (Sameness): an operator taking exactly one argument of a type the owner is assignable to.THE test behind E07187 (D24 Q4 REVISED, Steve 2026-10-20): can two values of this type be of DIFFERENT run-time types whose<=>is UNSET? Then<?and>?have no lesser or greater value to select, and an unset value cannot be built to stand in for one (aT()may be set, absent, private or abstract, and would run developer code).For a message: how a type for whichMayMixRuntimeTypesholds can have values of different run-time types - "a trait", or "an abstract" / "an open" followed by "class", "record" or "component".THE sameness a type would inherit through its super CLASS chain (D24 follow-up Q5, Steve 2026-10-20): the nearest concrete<=>comparing its owner with itself (NearestSelfComparisonAbove) - the super is ORDERED - else the nearest such==- the super is EQUATABLE only.THE sameness a type that declares none of its own gets from its super CLASS chain once PRE_IR_CHECKS has run (D55):NearestSamenessAbove, but a<=>that does not survive (OrderingAvailability.orderingSurvives(MethodSymbol, ISymbol)) is passed over for the nearest==- the super is EQUATABLE only.THE test of whether a sameness comparison - the type's==or<=>, hand-written or generated, or a generated==/<>answered by its<=>- needs the run-time-type check in front of it (D24 rule 3, Contract 22): values of different run-time types are never the same.🛑 THE ONE question "can this<=>(and the ordering built on it) be used?" (D55, D58, D62, D63, D71) -OrderingAvailability.orderingSurvives(MethodSymbol, ISymbol),OrderingAvailability.bareOrderingRetracted(IAggregateSymbol, ISymbol),OrderingAvailability.withdrawnOrdering(IAggregateSymbol, ISymbol)andOrderingAvailability.isUnavailableOrdering(MethodSymbol, ISymbol)with the readings built on them.THE inherited sameness signatures a type with its own sameness OVERRIDES (D24 rule 3; N07 - the object decides, never the reference): for each of==and<=>the type declares taking exactly itself, every same-named comparison above it on its super CLASS chain (AllOperatorsAbove) that takes a type the owner is assignable to and that the owner does not declare itself (OwnOperatorTaking).The owner's own non-abstract operator of one name taking exactly that one type, if any - whatOverriddenSamenessSignaturesasks of each inherited signature.THE retraction step (D55/D58/D62): whenOrderingAvailability.bareOrderingRetracted(IAggregateSymbol, ISymbol)says the type's bare ordering is withdrawn, mark each of its bare ordering operators (<=>,<,<=,>,>=)DEFAULT_OPERATOR_RETRACTED, which the type's method set then filters out, so none is generated.THE walk behindInheritedSameness,SealedSamenessandSortOwnerAbove: the first sameness above a type (its supers and traits, breadth first, each once) whose declaring type passes an owner test.One sameness found above a type: the level of the walk it was found at (a parameterised type stays itself, so its display name can be rendered) and the operator, read from that level's declaring type.THE SEALED sameness a type inherits (D24 rule 1) - one written by hand on an abstract base or a trait above it (IsHierarchyWideSameness) - if any.THE sort owner of a type (D52 residual, Steve 2026-10-21, option a): the type a streamsortgroups its values by before comparing any two with<=>.Is this the named method with exactly one parameter, of a type the aggregate is assignable to? The generated comparisons' reading (HasOwnComparator,HasHandWrittenEquality).A field whose type cannot be ordered, found on a type, and the type that declares it (OrderingAvailability.unorderedPropertyBehind(MethodSymbol, ISymbol)).THE wording of why a type has no<=>although it asked for one with the baredefault operator(D58): the field whose type cannot be ordered, the type declaring it and - only where that is a super - that a sub-type follows its super.