Package org.ek9lang.compiler.support.sharing


package org.ek9lang.compiler.support.sharing
  • Class
    Description
    The call chain that starts at a variable or this: a link that may return a VIEW of what it was called on makes the result the same object as (part of) the receiver.
    May a compound assignment (target += item, target :~: item) to a value of this type keep its operand? A container (a parameterised type, a bare T) does; so does a type of the program's own, whose operator is written in EK9 and may store it - as any call of the program's own may keep its argument (KeepsArgument; the verifier, 2026-10-21: registry += item, Registry's += adding to its list, was read as keeping nothing, so a loaned closeable was closed by its statement and then used).
    One in-place write whose reach ReachOfInPlaceWrite reads.
    Does an in-place write of an object of this type (a mutating operator: other -= 5, other++, this :=: copy; or a stream target's |) run code of the program's own (D66)? A concrete built-in's operator does not, unless it may call that operator back on an element (MayBeCalledBack: a Dict merge merges the elements that share a key).
    THE coalescing test: ?:, <?, >? (??, <=?/>=? keep their grammar tokens only so phase 1 can report E01096/E01095 - they never reach here).
    A variable (never a constant: each read of one is a copy) or this/super.
    D66 gap (Steve, 2026-10-21): does a for ... in loop over a value of this type run code of the program's own? THE test: the loop calls iterator() and then hasNext()/next() (or those two on the value itself), so it is a call that is not pure when the type - or the iterator its iterator() declares to return - has one of those methods that is not pure and is supplied by the program: a method written in EK9, or an abstract one of a built-in trait or abstract type (Iterator, Iterable) a program implements.
    May the callee keep its argument? Built-ins say so in their RETAINS; anything else may.
    THE test of whether an object of this type may be handed to a built-in that calls a member of it back that is not pure (D66).
    May the value of this expression BE an object that exists already - rather than a fresh one: a variable (not a constant, which is read as a copy), this/super, a call whose RETAINS says its result may be its receiver's interior or an argument (MayAlias), or a coalescing operator's result or a ternary's when EITHER operand may be (the result is one of them: the same route ObjectSharing follows for the operand itself).
    Is the expression, looking through parentheses, of a SHAPE whose value may be an object that already exists - a variable, this/super, a call, or a coalescing operator or ternary (whose result IS one of its operands) - so only MayBeExistingObject, once phase 5 has derived the RETAINS of the program's own callables, can say whether it is.
    May the value given to a name be, or hold, an object from OUTSIDE the code being analysed (D66) that the name is not recorded as sharing with: this - itself, or held by a list, a Dict, a constructor's or call's arguments or a dynamic function's or class's capture list (box <- Box(this)) - or a result a call, a coalescing operator or a ternary hands back that may be an existing object.
    May a value of this type be of a type of the program's own - whatever it declares? A trait, an abstract class, an open class (Any included) or a generic's T.
    May a callee change the objects it is given as arguments? Not when it is pure, nor when it is a concrete built-in method or function that runs no code of the program's.
    May the call (or stream stage operand) call run code of the program's own - something that is not pure and not a concrete built-in? Such code may change any object it can reach, an object kept where the caller cannot name it included.
    THE reading of what one occurrence of a name does to the OBJECT the name refers to - for every analysis that remembers what a variable holds (the phase-5 value tracker behind E08086, CompileTimeKnownText behind E08275).
    What an occurrence does to the object.
    One occurrence's effect.
    What this or super - the object a method runs on, whose name is no identifier - does to that object, read exactly as the occurrence of a variable is (ObjectSharing): kept where the whole expression is kept (items += this, box <- Box(this), (this) is ...), or the start of a call chain that may return a view of it (this.me()).
    What occurrence - an identifier the compiler bound to a symbol - does to the object it names; empty when it only reads it, or stores a new object in it.
    ((base)) is base: climb the parentheses.
    D66 gap (verifier, 2026-10-21): does a for range over values of this type run code of the program's own? The range builds its counter and each loop value with the type's copy constructor and moves the counter with ++/-- (or +=/-= by a step), comparing with <=>: a program type with any of those not pure runs that code, which may change what it can reach (a copy shares its fields).
    What a call can REACH (D66, Steve 2026-10-21): the objects it is given.
    The objects an expression given to a call (or written into an object, or iterated) gives it: a name, this, what a call that makes one, a list, a Dict, a coalescing operator or a ternary holds; any other expression builds a new value from its operands.
    THE reading of what a call that may run the program's own code can change: everything reachable from Reach, which the value tracker turns into what it forgets (ValueTrackingAnalyzer.recordCallThatMayChange).
    THE reading of an in-place write as a call (D66, Steve 2026-10-21): when the operator that makes it is the program's own code (InPlaceWriteRunsProgramCode), it is a call that is not pure, given the object written and whatever the right-hand side gives it (other -= amount), or - for a stream target - every element of the stream.
    What a for loop over iterated can reach (D66, the same reading as ReachOfCall gives a call): the value iterated - a name, this, or something no name is given to - and what it is made from.
    The Reach being gathered over one call, loop or in-place write, with the recorded-symbol lookup of the phase asking: the walk of ReachedByExpression adds to it.
    What a call node resolved to, or null when nothing was recorded; a recorded symbol that is not a call (a delegate, a stage operand) is answered as itself.
    THE retention walk of ObjectSharing (D61): the object an expression evaluates to (or contains) - what keeps it? The variable it is stored in, a container it is added to or put in a literal of, a call or constructor that may keep its argument, a for loop's variable, a stream's holders, or the returning variable of a construct whose value is assigned - ObjectSharing.Kind.SHARED with a nameable holder, else ObjectSharing.Kind.ESCAPES.
    A stage operand that is a function, or a delegate holding one, that may change what it is given.
    The variable a declaration or a plain store gives the value of assigned to, or null.
    The target's own KIND half of CompoundTargetMayKeep: may a compound assignment to a value of this type keep its operand at all? A container (a parameterised type, a bare T) and a type of the program's own may; a built-in value, a constrained type over one and an enumeration copy.