Skip to content

x/y/z bindings not restored when a function body throws #9

Open

Description

@tangentstorm

From the Codex whole-repo review on #5 (review comment).

Location: imp-eval.mts:495 on main (6813323)

[P2] Restore parameter bindings when a function body throws

If lastEval throws, execution skips restoration of the saved x, y, and z bindings, leaving function arguments in the shared word dictionary. In separate evaluations, x: 10, f: {x + bad}, and f[99] demonstrate this: after catching the undefined-word error, evaluating x returns 99 rather than 10. Since the REPL and MCP worker catch evaluation errors and continue using that dictionary, a failed call silently corrupts subsequent program state. Restore the bindings in a finally block.

Checked 2026-10-29: still present on main; not touched by open PRs #3, #4 or #7.

Activity

  1. added
    follow-upFiled from a review finding or neighboring case that belongs in its own change.
    on Oct 29, 2026
  2. moved this to Backlog in implishon Oct 29, 2026
  3. added
    approvedThe human approved the issue. Workers start only on approved issues.
    on Oct 29, 2026
  4. moved this from Backlog to Pending in implishon Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedThe human approved the issue. Workers start only on approved issues.follow-upFiled from a review finding or neighboring case that belongs in its own change.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions