syntax: a closure binds a var parameter (CONCURRENCY gap 5, part of slice F) #156
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Gap 5 of CONCURRENCY.md (ECS.md gap 4), the second part of slice F, split out of #4: a closure may bind a
varparameter. The body ofwindowswants to be a closure that captures a frame time or a scale factor, and a namedfncannot capture.Source
Goal
varin front of a closure parameter name, with the existing escape rule (BACKEND 5.8) deciding whether the closure may keep the reference. Todaypoints.each { var point => ... }iserror: A binding needs a valueand two parameters with avaramong them is a parse error.Acceptance criteria
{ var point => point.x = point.x + 1 }and{ (var point, scale) => ... }parse and type check against a parameter type(var value: Point) => Voidand(var value: Point, scale: Float) => Void.forEach-style function takingbody: (var value: Point) => Void, called with a closure that captures a localFloat, asserts the mutated values).varparameter beyond the call (stored in a field, returned, captured by aspawnclosure) is refused by the existing escape rule with a diagnostic; probe for each of the three.varclosure parameter where the type has none, or the reverse) is a checker error that says which side isvar.torb format --check), the language server's parameter hover anddocs/language(the closure page) know the form;docs check docsgreen.Touches the seed?
syntax/parser, theA binding needs a valuesite inparser/statements.trb). CLAUDE.md "Seed and breaking changes": the first commit teaches the form; the seed does not know it, socompiler/srcandstd/must not use the new form, which keeps this a single commit with no seed refresh and no migration. A later use insidestd/waits for a seed refresh, which is the owner's call (the loop never refreshes the seed).Size
One PR, one or two Conventional Commits:
feat(syntax): a closure binds a var parameterand, if the lowering needs its own change,feat(ir): lower a closure with a var parameter. The type form(var value: Component) => Voidand a namedfnpassed to it already work, so the by-reference convention exists; the new work is the parser, the checker's parameter binding and the closure conversion. If the implementer finds the lowering needs more than that, stop and split instead of widening the PR. Implementer: opus/high (parser, checker, IR).Dependencies
None.
Part of #4.
Windowandwindows(CONCURRENCY slice F, gap 6) #4Windowandwindows(CONCURRENCY slice F, gap 6) #4Windowandwindows(CONCURRENCY slice F, gap 6) #4[loop:torbscript] claim implement by session:loop-torbscript-20261007 until 2026-10-08T00:53:27Z
[loop:torbscript] implement: PR #161 (one commit
5510623feat(syntax): a closure binds a var parameter, 22 files) is open against main, review requested from argus. The worker timed out before writing this result; gates per the PR body (tier A in a container, check-commits green, tier B left to CI). Forge CI on5510623is running. Two points for review are in the PR body: the parenthesized form{ (var point, scale) => ... }from the acceptance criteria is a parse error pointing to{ var point, scale => ... }, and the reversevarmismatch. Worker token usage is not measurable. Claim 599 released, next: review[loop:torbscript] PR #161 merged by argus at 2026-10-08T00:09:38Z (merge commit
d55c8d9). Issue closed; the PR has no after-merge release or deploy steps. Follow-up (not started): using the form insidestd/waits for a seed refresh (owner call).Windowandwindows(CONCURRENCY slice F, gap 6) #4