Class NaturalOrderQueue
- All Implemented Interfaces:
BiFunction<ISymbol, ISymbol, Optional<String>>
PriorityQueue ordered by its elements' natural order needs an orderable element type
(D63, Steve 2026-10-21, option B). PriorityQueue of T sorts by T's <=> unless it is given a
comparator, and PriorityQueue of Foo is ONE type whether or not it will carry one, so the requirement cannot
sit on the parameterisation. It sits on the CONSTRUCTION instead: a construction of PriorityQueue of X
(PriorityQueue() of X, PriorityQueue(item), a target-typed PriorityQueue(), collect as
PriorityQueue of X) that is not directly the receiver of .withComparator(...) needs X to be
orderable (OrderingAvailability.isOrderable(IAggregateSymbol, ISymbol)) - else E07620, the verdict a comparator-less stream sort
over X gets (phase 3 ComparatorPresentOrError, then OrderingAvailability.withdrawnOrdering(IAggregateSymbol, ISymbol)):
the two can differ only below an ordered super, where E07186 already refuses the sub-type. No flow analysis: a queue
built first and given its comparator in a later statement is the same error.
Inside a generic body X may be the conceptual T: the queue then uses T's <=> exactly
as a comparator-less sort over T does, and takes the sort's own steps - phase 3 notes T's
<=> as used (phase3/ComparatorPresentOrError, so phase4/ParameterisedTypeOrError judges the
type argument where T is substituted) and phase 5 asks OrderingAvailability.withdrawnOrdering(IAggregateSymbol, ISymbol) for a
constrained T. Any other X that is a concrete type or a function type is judged here in phase 5
(phase5/RetractedComparatorUseOrError), where the bare default operator's retraction is known. A type
BUILT ON T (OrderedBox of T, DictEntry of (K, Integer)) is judged as declared there too, and
is also recorded in phase 3 (conceptual/NoteNaturalOrderQueue) so that phase 4 (
ParameterisedTypeOrError) asks this of the type with its parameters replaced (D63 residual). This class holds the
wording - applied to an element type and the Any type, E07620's wording when it cannot be ordered - and
QueueElementNeedingOrder and QueueElementType the detection, so the places cannot disagree; the queue
is recognised through the symbol (Ek9Types.ek9PriorityQueue()), never by name.
-
Constructor Details
-
NaturalOrderQueue
public NaturalOrderQueue()
-
-
Method Details