Compile lexically scoped source bodies once - #95
Merged
Conversation
robertvansteen
force-pushed
the
STRAT-733-subprogram
branch
2 times, most recently
from
August 17, 2026 09:39
11ef5dd to
b8138de
Compare
robertvansteen
force-pushed
the
STRAT-733-subprogram
branch
3 times, most recently
from
August 17, 2026 13:15
c1e95b3 to
1f9ec08
Compare
robertvansteen
force-pushed
the
STRAT-733-subprogram
branch
from
August 17, 2026 19:11
1f9ec08 to
1467286
Compare
robertvansteen
marked this pull request as ready for review
August 18, 2026 10:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ScopedExpressionwith explicit parameter names and no reserveditemconventionSourceCompilation::scope(), with local parameters shadowing equal outer names and every other symbol resolving lexicallyanyexampleWhy
Host sources such as existential list predicates need to run one ordinary Axiom expression against several values without recompiling it for every item. The body should compose like the rest of the language: names explicitly bound by its owner are local, while free inputs and definitions retain their normal enclosing meaning.
This provides that scoped evaluation mechanism without callbacks, a magical parameter name, a first-class function type, or a generic lambda value in the persisted language.
Impact
Extension authors can persist a
ScopedExpression, supply its parameter types from certified sibling sources, and invoke the resultingCompiledScopedExpressionfromSourceEvaluation. Bound parameters stay out of public input, definition, andProgram::$referencesanalysis; genuinely free symbols remain ordinary enclosing inputs and program references.The supplied local values skip a redundant public-boundary admission because the owning source compiler obtained them from certified compiled parents. Host-specific portability policies remain the host's responsibility.
The branch is rebased onto current
0.x(v0.6.14). Scoped compilation composes with the compiler-owned reference analysis from #90 and the demanded-binding boundary from #92: local parameters are excluded from public references, while captured outer symbols are retained.Validation
composer test:typescomposer test:unit— 1,219 tests, 4,701 assertions, 100% line coveragecomposer test:infection— 2,333 mutants, 100% MSI and mutation coveragegit diff --check