ek9_query_purity_impact
Answers first: status, change, availableChanges, verdict (ready / would-fail / cascade-too-large / blocked-refuse-to-root), callerNames, calleeNames, then anchor, contract, afferent, efferent axes - the same closure ek9_fix_purity_contract applies.
When to use it
'Who breaks if this stops being pure, or what must become pure if it does' is one call with symbol:'Type.method' - on a callable flagged E08130/E05150/E05160 the change the compiler asks for, on any other the what-if (changeKind:'purity-what-if', nothing to apply).
When not to use it
- applying the purity fix, not previewing it (use
ek9_fix_purity_contract) - previewing a signature change (add/remove/reorder params, return type), not a purity change (use
ek9_query_signature_impact) - raw caller/callee chains without the purity verdict overlay (use
ek9_query_call_graph) - the list of purity errors first, to find a callable to anchor on (use
ek9_query_diagnostics)
Details
Returns a BlastRadius (BlastRadiusJson): anchor callable + three axes — 'contract' (the override group; root is the ONLY legal edit anchor), 'afferent' (transitive pure-caller closure that breaks if pure is removed), 'efferent' (non-pure-callee closure that must become pure if pure is added) — each node with a verdict (root / fixable / breaks) and file:line. Overall verdict (ready / would-fail / cascade-too-large / blocked-refuse-to-root) is computed by the SAME rule ek9_fix_purity_contract applies, so picture and fix agree. change: 'remove-pure' = which CALLERS break if this stops being pure (the afferent axis); 'add-pure' = which CALLEES must become pure (the efferent axis); E08130 offers both, E05150 only add-pure, E05160 only remove-pure. Works under compile errors via an on-demand call graph; FULL_RESOLUTION (or default ek9_compile) suffices. The add-pure what-if (no purity error at the callable) also compiles the change in memory - the body's own rules (E08100 / E08120 / E08140) are no call graph's - and a change that adds errors is would-fail with them as wouldBeDiagnostics. A program named by symbol is its body; a type is refused with its members.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
change | string: add-pure | remove-pure | 'remove-pure' = which CALLERS break if this stops being pure; 'add-pure' = which CALLEES must become pure. Omit to take the natural direction for the diagnosed code (E08130 offers both - see availableChanges). | |
file | string | The EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site. | |
line | integer | 1-based line where the purity error (E08130 / E05150 / E05160) fires - OMIT it and pass symbol:'Type.method' to let the tool find the flagged line. | |
symbol | string | The flagged method or function - 'Type.method' or a function name - no file or line needed; the tool finds its first purity error. |
It also takes the arguments every tool takes.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it. 3 of the 7 recorded are shown.
E05150 contract axis
Request
{
"file" : "a.ek9",
"line" : 10
}
Response
{
"afferent" : [ ],
"anchor" : {
"detail" : "E05150",
"file" : "a.ek9",
"fullyQualifiedName" : "purity.probe.a::Derived.calc()",
"label" : "Derived.calc()",
"line" : 10,
"verdict" : "fixable"
},
"availableChanges" : [ "add-pure" ],
"calleeNames" : [ ],
"callerNames" : [ ],
"change" : "add-pure",
"changeKind" : "purity",
"contract" : [ {
"detail" : "contract root",
"file" : "a.ek9",
"fullyQualifiedName" : "purity.probe.a::Base.calc()",
"label" : "Base.calc()",
"line" : 6,
"verdict" : "root"
}, {
"detail" : "override — aligns to root",
...
Cut short here: 20 more lines. The whole recorded call.
E05160 contract axis
Request
{
"file" : "b.ek9",
"line" : 10
}
Response
{
"afferent" : [ ],
"anchor" : {
"detail" : "E05160",
"file" : "b.ek9",
"fullyQualifiedName" : "purity.probe.b::Derived2.calc()",
"label" : "Derived2.calc()",
"line" : 10,
"verdict" : "fixable"
},
"availableChanges" : [ "remove-pure" ],
"calleeNames" : [ ],
"callerNames" : [ ],
"change" : "remove-pure",
"changeKind" : "purity",
"contract" : [ {
"detail" : "contract root",
"file" : "b.ek9",
"fullyQualifiedName" : "purity.probe.b::Base2.calc()",
"label" : "Base2.calc()",
"line" : 6,
"verdict" : "root"
}, {
"detail" : "override — aligns to root",
...
Cut short here: 20 more lines. The whole recorded call.
No purity error what if
Request
{
"file" : "c.ek9",
"line" : 5
}
Response
{
"afferent" : [ ],
"anchor" : {
"detail" : "not pure - what if it becomes pure",
"file" : "c.ek9",
"fullyQualifiedName" : "purity.probe.c::sideEffect",
"label" : "sideEffect()",
"line" : 5,
"verdict" : "root"
},
"availableChanges" : [ "add-pure" ],
"calleeNames" : [ ],
"callerNames" : [ ],
"change" : "add-pure",
"changeKind" : "purity-what-if",
"contract" : [ {
"detail" : "contract root",
"file" : "c.ek9",
"fullyQualifiedName" : "purity.probe.c::sideEffect",
"label" : "sideEffect()",
"line" : 5,
"verdict" : "root"
} ],
"efferent" : [ ],
...
Cut short here: 14 more lines. The whole recorded call.
See also
- Show me in the IDE: Show Blast Radius