Class ProvenContainerChange
java.lang.Object
org.ek9lang.compiler.phase5.ProvenContainerChange
THE reading of whether something may change the OBJECT an Optional / Result / Iterator variable refers to, so that
a proof that its
get(), ok(), error() or next() is safe (E08030) no longer holds:
D66 ("a call that is not pure forgets what it can reach", Steve 2026-10-21) applied to the safe-access proofs.
It answers from the same readings the value tracker forgets by - ObjectSharing for one occurrence of a name,
ProgramCodeSites for the places code of the program's own runs, and the tracker's own sharing, escape and
from-outside record (ValueTrackingAnalyzer.mayBeChangedThrough(ISymbol, ISymbol),
ValueTrackingAnalyzer.mayBeChangedByCall(ISymbol, boolean, Collection)). Never a second list of the ways an object can change.
Where the tracker is not following a callable (it records nothing outside one) nothing is known about who shares what, so every change counts as a change to every container: it fails closed.
Before 2026-11-10 a proof survived everything but a store to the variable itself (E08040): if name? then
forget(name) with a forget that empties its argument (target :=: Optional()), then
name.get() compiled clean and threw 'No such element'.
-
Constructor Summary
ConstructorsConstructorDescriptionProvenContainerChange(SymbolsAndScopes symbolsAndScopes, ValueTrackingAnalyzer valueTracker, ObjectSharing objectSharing) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanbyOccurrence(ISymbol occurrenceSymbol, List<ObjectSharing.Use> uses, ISymbol container, boolean sharingCounts) May this occurrence ofoccurrenceSymbol- with the effectsuses(ObjectSharing) - change the objectcontainerrefers to? A mutating operator, a call that may change it or a holder nothing names keeping it does, through any name that may be the same object.(package private) booleanbySite(ProgramCodeSites.Site site, ISymbol container) May the program code run atsite(ProgramCodeSites) change the objectcontainerrefers to - through a name an in-place write or an iteration changes in place, or beyond the names it is given (a call's are judged as their own occurrences)?(package private) List<ObjectSharing.Use> usesOf(EK9Parser.IdentifierContext occurrence, ISymbol symbol) What one occurrence ofsymboldoes to the object it names (ObjectSharing); for a container itself, without what is done to its views -show(name.get())hands on the ITEM, which cannot empty the Optional (ObjectSharing.ofTheObjectItself(EK9Parser.IdentifierContext, Function)).(package private) List<ObjectSharing.Use> usesOf(EK9Parser.IdentifierContext occurrence, ISymbol symbol, List<ObjectSharing.Use> allUses) AsusesOf(EK9Parser.IdentifierContext, ISymbol), when every use of the occurrence (allUses,ObjectSharing.apply(EK9Parser.IdentifierContext, Function)) is already known: those, or for a container only the uses of the object itself.
-
Constructor Details
-
ProvenContainerChange
ProvenContainerChange(SymbolsAndScopes symbolsAndScopes, ValueTrackingAnalyzer valueTracker, ObjectSharing objectSharing)
-
-
Method Details
-
usesOf
What one occurrence ofsymboldoes to the object it names (ObjectSharing); for a container itself, without what is done to its views -show(name.get())hands on the ITEM, which cannot empty the Optional (ObjectSharing.ofTheObjectItself(EK9Parser.IdentifierContext, Function)). -
usesOf
List<ObjectSharing.Use> usesOf(EK9Parser.IdentifierContext occurrence, ISymbol symbol, List<ObjectSharing.Use> allUses) AsusesOf(EK9Parser.IdentifierContext, ISymbol), when every use of the occurrence (allUses,ObjectSharing.apply(EK9Parser.IdentifierContext, Function)) is already known: those, or for a container only the uses of the object itself. -
byOccurrence
boolean byOccurrence(ISymbol occurrenceSymbol, List<ObjectSharing.Use> uses, ISymbol container, boolean sharingCounts) May this occurrence ofoccurrenceSymbol- with the effectsuses(ObjectSharing) - change the objectcontainerrefers to? A mutating operator, a call that may change it or a holder nothing names keeping it does, through any name that may be the same object. Making ANOTHER name share the object (ObjectSharing.Kind.SHARED) changes nothing by itself; it counts only whensharingCounts- for a region read ahead of the walk, where the new name's later changes are not yet recorded as the same object's. -
bySite
May the program code run atsite(ProgramCodeSites) change the objectcontainerrefers to - through a name an in-place write or an iteration changes in place, or beyond the names it is given (a call's are judged as their own occurrences)?
-