Repository navigation
fix(env): a program's and a module's frame is a tree; pin x-lang v0.46.0 - #228
Merged
Merged
Conversation
x-lang v0.46.0 (x-lang#1154, x-engine-c v0.2.26) keeps a tree behind an environment whose spine the language made with pair, as a program's and a module's are here, where it kept a list of cells; law 10 says so. The runtime walked those frames as lists, so a lookup ran off a node into `first: () has no first`, and python-module-new handed pair a list of cells the engine then read as a tree. %py-env-tree? tells the two apart as law 10 does (the root, or pair?), and %py-env-cell and %py-env-rows take the environment and walk either. A cell found in a tree is the live one, so an assignment through it still rebinds the name. A module the runtime writes is made empty and bound with def. Spec: tests/specs/C0-env-frames.spec.md reads and rebinds a program's and a module's frame; on v0.46.0 its three cases fail before this change and pass after. The other 127 spec files pass on v0.46.0 too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
specs @ x-lang mainwent red on main on 2026-11-04: nearly every case gotError: first: () has no first.Cause. x-lang#1154 (c718db01, shipped in v0.46.0) moved the engine to x-engine-c v0.2.26. That engine keeps a tree behind an environment whose spine the language made with
pair, and law 10 indocs/engine-laws.mdwas rewritten to say so. A program's environment and a module's are made that way here ((pair () genv)). The runtime walked those frames as lists of cells, so a lookup ran off a tree node intofirstof(). Andpython-module-newhandedpaira list of cells, which the engine then read as a tree.Bisected locally with an x-python worktree on x-lang main (d64c3da6, the commit CI built):
x-lang changed the law on purpose and released it, so the fix is here.
Change.
%py-env-tree?tells the two kinds apart the way law 10 does: the root, orpair?.%py-env-celland%py-env-rowsnow take the environment and walk either a tree or a list. A cell found in a tree is the live one, so aglobalornonlocalassignment through it still rebinds the name.def.lang.xonand the CI matrix move to v0.46.0.Small known cost: a module's rows (
%py-mod-rows) now come out in the frame's tree order, not the order they were bound. No spec depends on that order.Verification (
specs.shon v0.46.0):tests/specs/C0-env-frames.spec.md: 3 of 3 fail with main'sruntime-flow.x, and 3 of 3 pass with this change.🤖 Generated with Claude Code