Package org.ek9lang.compiler.support.retention
package org.ek9lang.compiler.support.retention
-
ClassesClassDescriptionTHE 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 theunknownopt-out answers for them (unknownCounts): does a rule ofcallee(declared, derived, or the generic's own) that matcheswantedtake the argument given atparameterIndexas its source? WithunknownCounts, a callee declaringunknownanswers 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 matchingwanted- or theunknownopt-out, under which nothing may be assumed.Doescalleesay, by an EXPLICIT rule - declared by a built-in or derived for a user callable - that it keeps the argument it is given atparameterIndexsomewhere other than its result? The narrower question thanKeepsArgumentBeyondResult, which also counts the inexpressibleunknownopt-out: an unnamed closeable given to a callee that DEFINITELY keeps it is E81072; one given to a callee that may is handed on.Doescalleesay, 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 ofDefinitelyKeepsArgument: 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 isitems += this, closed the receiver and then the list held a closed object).May the call hand the argument it is given atparameterIndexback as (part of) its result -return <- <that parameter>? The narrower question thanRetainsArgument, which also counts an argument kept anywhere else (receiver <- item) and theunknownopt-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).Maycalleekeep the argument it is given atparameterIndexsomewhere 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.Maycalleekeep its receiver beyond the call - an explicit rule, or theunknownopt-out?A rule saying the RECEIVER itself is kept:<parameter> <- receiverorambient <- receiver.What may come to HOLD the argumentcalleeis given atparameterIndex, 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()andRetentionRule.source()), exactly the text a built-in declares: the destination isreceiver(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) orReturnRetention.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'sreadyHandler <- receiver): the destination is another parameter's name (the receiver is stored in what that argument refers to) orambient(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 ofMarkReturnsEachParameter.THE dispatch union (Steve, 2026-10-21, D61): a call throughdeclarationmay runoverride- 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 parameterparameterName-return <- parameterName, exactly the text a built-in declares (List.getOrDefault'sreturn <- 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 whatcalleereturns possibly share an object with its receiver or an argument.The MAY half ofDefinitelyKeepsArgument: doescalleesay, 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) incallee's declared parameters; -1 when it declares none of that name.The parameterscalleestores 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.Maycalleekeep (a reference to) the argument it is given atparameterIndex- into its receiver, another argument, its result or anywhere else (receiver <- item,return <- other, orunknown)? 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 ofCommonValues.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 whatcalleeRETURNS (everyreturn <- sourceit 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 whatcalleereturns possibly share an object with its RECEIVER.Every rule the callee declares or has derived, the generic's own included; none forunknown.