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-up
    on Oct 29, 2026
  2. moved this to Backlog in implishon Oct 29, 2026
  3. added
    approved
    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

    approvedfollow-up

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions