René's URL Explorer Experiment


Title: Unbox Ref/STRef operations in value positions (while-conditions, stored actions) · Issue #317 · purescript-lua/purescript-lua · GitHub

Open Graph Title: Unbox Ref/STRef operations in value positions (while-conditions, stored actions) · Issue #317 · purescript-lua/purescript-lua

X Title: Unbox Ref/STRef operations in value positions (while-conditions, stored actions) · Issue #317 · purescript-lua/purescript-lua

Description: Purescript compiler back-end for Lua. Contribute to purescript-lua/purescript-lua development by creating an account on GitHub.

Open Graph Description: Purescript compiler back-end for Lua. Contribute to purescript-lua/purescript-lua development by creating an account on GitHub.

X Description: Purescript compiler back-end for Lua. Contribute to purescript-lua/purescript-lua development by creating an account on GitHub.

Opengraph URL: https://github.com/purescript-lua/purescript-lua

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unbox Ref/STRef operations in value positions (while-conditions, stored actions)","articleBody":"## Problem\n\nThe cell unboxing of #239 lowers a `Ref`/`STRef` operation only in run position — where the application carries the magic-do run marker, or is the body of a literal loop lambda the native-loop lowering runs per iteration. An operation used as a first-class value keeps the whole cell boxed. The most visible casualty is the `while` condition: `map (_ > 0) (STRef.read value)` is an ST action value built once and forced per iteration, so the cell it reads stays a `{value = …}` table even when everything else about it would unbox. From `test/ps/output/Golden.NativeLoopsST.Test/golden.lua` after #239 — `steps` (run positions only) unboxes while `value` (read inside the condition value) stays boxed:\n\n```lua\nlocal steps = 0\nlocal value = Control_Monad_ST_Internal_new(start)()\ndo\n  local _S_cond0 = Control_Monad_ST_Internal_map_(function(v)\n    return v >= 0 and v ~= 0\n  end)(Control_Monad_ST_Internal_read(value))\n  while _S_cond0() do\n```\n\n## Approach\n\nLower a recognised operation in value position to a nullary Lua closure over the unboxed local — `function() return g(value) end` for the condition above — which is semantically what the boxed foreign chain builds (the closure shares the local as an upvalue, so each forcing sees the current contents). The subtlety is evaluation timing: the boxed form evaluates the operation's non-reference arguments when the thunk is built, not when it is forced, so a non-atomic argument must be pre-bound outside the closure (or the analysis must require atomic arguments in value positions). The while-condition case can go further: when the condition's compiled run is a pure expression, the native-loop lowering can inline it as the `while` predicate directly instead of building the thunk at all.\n\n## Relations\n\nExtends #239; the value-position restriction and this exact `countDown` shape are pinned by `Golden.NativeLoopsST.Test`. Independent of the Effect-side dictionary gap (filed separately).\n\n## Verification\n\n`countDown`'s `value` cell in `Golden.NativeLoopsST.Test` compiles with no `{value = …}` table and the loop condition reads the local; eval golden unchanged. A stored-action shape (`let action = STRef.write 5 r` re-run twice) unboxes with a fresh golden pinning it.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-27T12:27:26Z","url":"https://github.com/purescript-lua/purescript-lua/issues/317"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/issues/:id(.:format)
route-controllerissues
route-actionshow
fetch-noncev2:1d513a44-1f68-dc70-68cc-8a6a0a4464a7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBDE4:683FF:82AF28:AA138E:6B00D94A
html-safe-nonce8400fc8bb5c8eeb9325278983c55a7525de352c9074d850a488c5442e7c68f0e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREU0OjY4M0ZGOjgyQUYyODpBQTEzOEU6NkIwMEQ5NEEiLCJ2aXNpdG9yX2lkIjoiMTM5NDUzNDI5ODkzMzA1Nzg2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac74343cee20c47bf75c6d3f3b7452d6b293d27ab3859903d528e8c4b5fe7fc183
hovercard-subject-tagrepository:587200487
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///issues/show
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/purescript-lua/purescript-lua/issues/317
twitter:imagehttps://opengraph.githubassets.com/638e8137a878305176b6a64ef473983d87906a525f956c0c5c3b1c72df4432e4/purescript-lua/purescript-lua
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/638e8137a878305176b6a64ef473983d87906a525f956c0c5c3b1c72df4432e4/purescript-lua/purescript-lua
og:image:altPurescript compiler back-end for Lua. Contribute to purescript-lua/purescript-lua development by creating an account on GitHub.
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonea481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b
turbo-cache-controlno-cache
go-importgithub.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git
octolytics-dimension-user_id131581790
octolytics-dimension-user_loginpurescript-lua
octolytics-dimension-repository_id587200487
octolytics-dimension-repository_nwopurescript-lua/purescript-lua
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id587200487
octolytics-dimension-repository_network_root_nwopurescript-lua/purescript-lua
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release84c8c5cc25e2fb7f2308428458538436baecc6d2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/purescript-lua/purescript-lua/issues/317#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fissues%2F317
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fissues%2F317
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fissues%2Fshow&source=header-repo&source_repo=purescript-lua%2Fpurescript-lua
Reloadhttps://github.com/purescript-lua/purescript-lua/issues/317
Reloadhttps://github.com/purescript-lua/purescript-lua/issues/317
Reloadhttps://github.com/purescript-lua/purescript-lua/issues/317
https://github.com/purescript-lua/purescript-lua
New issuehttps://github.com/login?return_to=https://github.com/purescript-lua/purescript-lua/issues/317
New issuehttps://github.com/login?return_to=https://github.com/purescript-lua/purescript-lua/issues/317
Unbox Ref/STRef operations in value positions (while-conditions, stored actions)https://github.com/purescript-lua/purescript-lua/issues/317#top
OptimisationA Compiler Optimisationhttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22Optimisation%22
area: codegenLua code generation / printinghttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22area%3A%20codegen%22
enhancementNew feature or requesthttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/Unisay
Unisayhttps://github.com/Unisay
on Jul 27, 2026https://github.com/purescript-lua/purescript-lua/issues/317#issue-4987859280
#239https://github.com/purescript-lua/purescript-lua/issues/239
#239https://github.com/purescript-lua/purescript-lua/issues/239
#239https://github.com/purescript-lua/purescript-lua/issues/239
Unisayhttps://github.com/Unisay
enhancementNew feature or requesthttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22enhancement%22
area: codegenLua code generation / printinghttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22area%3A%20codegen%22
OptimisationA Compiler Optimisationhttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22Optimisation%22
on Jul 27, 2026https://github.com/purescript-lua/purescript-lua/issues/317#event-28536915338
Sign up for freehttps://github.com/signup?return_to=https://github.com/purescript-lua/purescript-lua/issues/317
Sign in to commenthttps://github.com/login?return_to=https://github.com/purescript-lua/purescript-lua/issues/317
OptimisationA Compiler Optimisationhttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22Optimisation%22
area: codegenLua code generation / printinghttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22area%3A%20codegen%22
enhancementNew feature or requesthttps://github.com/purescript-lua/purescript-lua/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.