fix(eval): error on silent rebinding in the same scope #24

Closed
opened 2026-07-02 14:03:37 +00:00 by toph · 0 comments
Owner

Currently --x = … twice, or rebinding a corner .a, silently replaces the binding (Hashtbl.replace in eval.ml:254,294). The step/macro design justifies = with "constructions are immutable, so there is no reassignment case" — the implementation contradicts that, and spec §8 lists no duplicate-binding error.

Make duplicate binding in the same scope an error. When the step slice lands, the same rule must hold across every export form: export-all and inline validate each landed name exactly like selective export, and ! applies per name in all forms. A shadowing marker that only guards the narrow path is worse than none — readers will trust an invariant that doesn't hold.

Currently `--x = …` twice, or rebinding a corner `.a`, silently replaces the binding (`Hashtbl.replace` in `eval.ml:254,294`). The step/macro design justifies `=` with "constructions are immutable, so there is no reassignment case" — the implementation contradicts that, and spec §8 lists no duplicate-binding error. Make duplicate binding in the same scope an error. When the step slice lands, the same rule must hold across every export form: export-all and `inline` validate each landed name exactly like selective export, and `!` applies per name in all forms. A shadowing marker that only guards the narrow path is worse than none — readers will trust an invariant that doesn't hold.
toph closed this issue 2026-07-03 00:39:23 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch#24
No description provided.