Package org.ek9lang.compiler.support.retention


package org.ek9lang.compiler.support.retention
  • Classes
    Class
    Description
    THE write of a derived RETAINS rule: marks the callable as DERIVED and adds the rule text.
    THE argument question the argument readers ask (RetainsArgument, HandsBackArgument, KeepsArgumentBeyondResult, DefinitelyKeepsArgument, MayKeepArgument), so they differ only in which rules count (wanted) and in whether the unknown opt-out answers for them (unknownCounts): does a rule of callee (declared, derived, or the generic's own) that matches wanted take the argument given at parameterIndex as its source? With unknownCounts, a callee declaring unknown answers yes - also for an index it does not declare.
    THE declared parameters of a method, operator or function a RETAINS rule names; none for anything else.
    THE method or function a recorded symbol CALLS, when it is a call that hands back a value made elsewhere: a method, operator or function call - never a constructor, whose result is always fresh.
    THE method, operator or function an expression CALLS when the whole expression is that call - a.get(k), first(), a + b, (a.get(k)) - so its value is whatever the call handed back.
    Does the callee (or, for a member of a parameterised type, the generic's own member) declare a rule matching wanted - or the unknown opt-out, under which nothing may be assumed.
    Does callee say, by an EXPLICIT rule - declared by a built-in or derived for a user callable - that it keeps the argument it is given at parameterIndex somewhere other than its result? The narrower question than KeepsArgumentBeyondResult, which also counts the inexpressible unknown opt-out: an unnamed closeable given to a callee that DEFINITELY keeps it is E81072; one given to a callee that may is handed on.
    Does callee say, by an EXPLICIT rule - declared by a built-in (readyHandler <- receiver) or derived for a user method - that it keeps the object it is called ON beyond the call: stores it in an argument or where nothing here can name it? The receiver's half of DefinitelyKeepsArgument: an unnamed closeable that is the RECEIVER of such a call is E81072 (D80 follow-up, 2026-10-21: Tracked("r").registerIn(kept), whose body is items += this, closed the receiver and then the list held a closed object).
    May the call hand the argument it is given at parameterIndex back as (part of) its result - return <- <that parameter>? The narrower question than RetainsArgument, which also counts an argument kept anywhere else (receiver <- item) and the unknown opt-out: the closeable ownership decision reports a hand-back (E81072) and treats any other keeping as handed on.
    Was the callee's retention DERIVED by phase 5 (a user callable) rather than DECLARED (a built-in's @Ek9Retains)? The closeable ownership decision treats the two differently: a derived link is honoured only where the return type may hold a borrowed view (support/BorrowedViewReturn).
    May callee keep the argument it is given at parameterIndex somewhere other than its result - into its receiver, another argument, or anywhere (receiver <- item, unknown)? The question a constructor passing its own parameter on asks to know whether the parameter outlives the construction.
    May callee keep its receiver beyond the call - an explicit rule, or the unknown opt-out?
    A rule saying the RECEIVER itself is kept: <parameter> <- receiver or ambient <- receiver.
    What may come to HOLD the argument callee is given at parameterIndex, other than its result: the receiver (RetentionRule.RECEIVER) and the names of the other parameters it may store the argument into (receiver <- item, items <- item).
    Record, on a user method, operator or function, that the argument given for a parameter may be kept beyond the call - the rule <destination> <- <parameter> (RetentionRule.destination() and RetentionRule.source()), exactly the text a built-in declares: the destination is receiver (stored in a property of the object), another parameter's name (added to the object that argument refers to), ambient (held where nothing here can name it: a capture, a returned closure, a call that keeps it) or ReturnRetention.UNIMPLEMENTED.
    Record, on a user method or operator, that the object it is called on may be kept beyond the call - <destination> <- receiver, exactly the text a built-in declares (HTTP.whenReady's readyHandler <- receiver): the destination is another parameter's name (the receiver is stored in what that argument refers to) or ambient (held where nothing here can name it: a capture, a returned closure, a call that keeps it).
    Record that an abstract declaration nothing implements MAY keep each of its arguments (unimplemented <- <parameter>, ReturnRetention.UNIMPLEMENTED); the keep counterpart of MarkReturnsEachParameter.
    THE dispatch union (Steve, 2026-10-21, D61): a call through declaration may run override - a method that overrides it, or a function (dynamic functions included) whose super function it is - so the declaration also returns whatever the override does, and keeps whatever the override keeps (the lane callee-keep, 2026-10-21: receiver <- item, <otherParam> <- item, ambient <- item).
    An abstract declaration no program code implements: which implementation runs cannot be known, so its result may be any of its arguments - return <- <each parameter>.
    Record, on a user method, operator or function, that what it returns may be the argument given for the parameter parameterName - return <- parameterName, exactly the text a built-in declares (List.getOrDefault's return <- defaultValue).
    Record, on a user method or operator, that what it returns is (part of) its receiver (ReturnRetention.RECEIVER_INTERIOR, exactly the text a built-in declares).
    Does what callee returns possibly share an object with its receiver or an argument.
    The MAY half of DefinitelyKeepsArgument: does callee say, by an EXPLICIT rule, that it keeps the argument - or is it an abstract declaration nothing implements, which MAY keep any argument (ReturnRetention.UNIMPLEMENTED)? An unnamed closeable given to such a callee is E81072 (nothing could close it); a named try resource given to it is allowed.
    THE index of the parameter a RETAINS rule names (parameterName) in callee's declared parameters; -1 when it declares none of that name.
    The parameters callee stores its receiver INTO by an explicit rule (items <- receiver, declared or derived): the names of the arguments that end up holding the object it is called on.
    May callee keep (a reference to) the argument it is given at parameterIndex - into its receiver, another argument, its result or anywhere else (receiver <- item, return <- other, or unknown)? An argument the callee keeps is no longer the caller's alone.
    The RETAINS text of the callee itself and of the generic it is a parameterisation, or member, of.
    THE reading of CommonValues.RETAINS - what a call's RESULT may share with what it was called on, and which arguments (or receiver) a callee may keep.
    THE rules saying what callee RETURNS (every return <- source it declares or has derived, the generic's own for a parameterisation or a member of one) - for a caller that must map each source back onto the receiver or the argument it names (phase5/ReturnSourceKind.origins).
    Does what callee returns possibly share an object with its RECEIVER.
    Every rule the callee declares or has derived, the generic's own included; none for unknown.