Class ConceptualAccess

java.lang.Object
org.ek9lang.compiler.support.ConceptualAccess

public final class ConceptualAccess extends Object
THE record of what a generic's body USES of its conceptual T, and the reading of it. Inside a generic body T has only a placeholder's members, so every constructor, method or operator the body calls on it is marked, and when a type argument is substituted (phase4/ParameterisedTypeOrError) it must have each marked member - and, for a pure scope or a range, a pure one - or the parameterisation is an error (E07620, E10032) instead of IR generation failing on a compile-clean program.

Three phase-3 places wrote the marks by hand and phase 4 read them raw (front-end rationalisation B-11): a call of T() or a method (ResolveIdentifierReferenceCallOrError), an operator (RequiredOperatorPresentOrError, and every route that resolves one) and a for range over T (ForRangeOrError). They hold a NoteConceptualAccess (or NoteIfConceptual, NoteRangeCopyConstructor); the reader asks IsConceptuallyAccessed, IsAccessedInPureScope and IsAccessedByRange. A comparison coalescing operator on T marks T itself (NoteCoalescingComparison, E07187).

An ordering of a type BUILT ON T - a comparator-less sort, a natural-order PriorityQueue, <?, a range or a comparison over DictEntry of (K, Integer), OrderedBox of T - is recorded the same way (NoteOrderingUse, NoteNaturalOrderQueue, on each T the type is built on) and judged where the parameters are substituted (OrderingUsesOf, phase4/ParameterisedTypeOrError), with the verdict the same type gets when it is written directly (D71, D63). Phase 3 cannot judge it: the type's <=> survives over the conceptual T and is withdrawn for some type arguments.

A generic's own hand-written <=> that compares its T values - directly, through its own methods, through generic functions, or by giving them to a function delegate - is only as total as the <=> of the type T is given (D89, D91 step 4): each step is recorded on T (ConceptualAccess.OrderingStep, phase 3) and the steps from that <=> are followed where T is substituted (TypeParameterOrderedInOwnComparison, E07188).

The parts live in support.conceptual, one step each; this class keeps the vocabulary of an ordering use (ConceptualAccess.OrderingKind, ConceptualAccess.OrderingUse) and of an ordering step (ConceptualAccess.OrderingStep) that AggregateSymbol holds.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    How the generic's body asks a type built on its type parameters to order, which decides the verdict where the parameters are replaced: exactly the one the same type gets when it is written directly (phase 5's RetractedComparatorUseOrError).
    static final record 
    One step towards a <=> on a bare type parameter, recorded on that parameter (D89, D91 step 4): the body of a method or function orders the parameter's values itself (into null - a <=> on them, or a value given to a function delegate), or hands them on to another body that may (into, whose own parameter intoParameter they become - the generic's own method, the same parameter; a generic function, the type parameter they are bound to).
    static final record 
    One ordering the generic's body asks of a type built on its type parameters.
  • Method Summary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait