Title: Renumber capture guard: extend the free-spelling skip to composite images · Issue #310 · purescript-lua/purescript-lua · GitHub
Open Graph Title: Renumber capture guard: extend the free-spelling skip to composite images · Issue #310 · purescript-lua/purescript-lua
X Title: Renumber capture guard: extend the free-spelling skip to composite images · Issue #310 · purescript-lua/purescript-lua
Description: Problem The emission-time renumbering pass (Language.PureScript.Backend.Lua.Renumber, #306) guards against capturing free (global) references by skipping, during index allocation, any index whose direct prefix_S_index spelling occurs fre...
Open Graph Description: Problem The emission-time renumbering pass (Language.PureScript.Backend.Lua.Renumber, #306) guards against capturing free (global) references by skipping, during index allocation, any index whose d...
X Description: Problem The emission-time renumbering pass (Language.PureScript.Backend.Lua.Renumber, #306) guards against capturing free (global) references by skipping, during index allocation, any index whose d...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/310
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Renumber capture guard: extend the free-spelling skip to composite images","articleBody":"## Problem\n\nThe emission-time renumbering pass (`Language.PureScript.Backend.Lua.Renumber`, #306) guards against capturing free (global) references by skipping, during index allocation, any index whose direct `prefix_S_index` spelling occurs free in the chunk. That guard covers the terminal-run shapes — for a binder `x_S_5` next to a free global `x_S_0`, allocation skips `0` and renumbers to `x_S_1`:\n\n```lua\n-- before -- after\nlocal x_S_5 = 1 local x_S_1 = 1\nreturn x_S_5 + x_S_0 return x_S_1 + x_S_0\n```\n\nIt does not cover composite images: a derived name embeds its run mid-name (a dispatcher `b_S_5_S_loop` renumbering in step with member `b_S_5`), and the guard only checks the member spelling `b_S_0`, not the composite `b_S_0_S_loop`. A hand-written FFI file that reads a global literally named `b_S_0_S_loop` would be captured by the renamed dispatcher local.\n\nThe class is close to unreachable in practice: it needs an FFI global whose name both embeds a supply-shaped digit segment mid-name and lands exactly on a renumbered composite spelling. No real FFI code does this; the direct-spelling guard already covers every name the compiler mints today whose image equals its full spelling.\n\n## Approach\n\nExtend the guard to post-check the full rebuilt image of every renamed binder against the chunk's free-name set, and on a hit re-allocate deterministically (bump the run's index until the composite clears). Idempotence and stability must be preserved — the skip has to be a pure function of chunk structure, mirroring how the existing counter-level skip re-derives on a second pass. `Note [Supply-drawn digit runs]` in the module documents the current guard's scope.\n\n## Prerequisites / Relations\n\nIndependent; hardens the pass merged in #306. No open issue depends on it.\n\n## Verification / Measurement\n\nA unit fixture in the pass's spec: a chunk binding `b_S_5` and its dispatcher `b_S_5_S_loop` alongside a free global read of `b_S_0_S_loop` must renumber the pair away from the collision (today the dispatcher lands exactly on the free spelling). The existing idempotence property (chunks generated over supply-minted name pools) and the golden corpus must stay green and byte-identical — no real artifact exercises the class.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-26T21:07:03Z","url":"https://github.com/purescript-lua/purescript-lua/issues/310"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:65465a24-c1df-5415-b378-bc0234e9228d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D45C:EDA7A:55BBD8:6EBE31:6B00DB69 |
| html-safe-nonce | 68afa570b1f2294a50a6c6c9a68260e4acb51accde213a7447f5f1160e1ba361 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDVDOkVEQTdBOjU1QkJEODo2RUJFMzE6NkIwMERCNjkiLCJ2aXNpdG9yX2lkIjoiNDczNjI5NTMwNTA4NjAzMjc0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e640f2aa4b4e8fdff766ee05715dee719c369e67d6d859b6083deee92bbb9670 |
| hovercard-subject-tag | issue:4982532182 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua/310/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a46ace8b164ad01a5edd262febfeca0faa7f055ffd9ed950f5960f0c1ca5afaa/purescript-lua/purescript-lua/issues/310 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a46ace8b164ad01a5edd262febfeca0faa7f055ffd9ed950f5960f0c1ca5afaa/purescript-lua/purescript-lua/issues/310 |
| og:image:alt | Problem The emission-time renumbering pass (Language.PureScript.Backend.Lua.Renumber, #306) guards against capturing free (global) references by skipping, during index allocation, any index whose d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 587200487 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587200487 |
| octolytics-dimension-repository_network_root_nwo | purescript-lua/purescript-lua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width