js: Variant, Switch, arrays, closures and references under Node (slice 2 of #63) #684

Closed
opened 2026-10-30 07:50:13 +00:00 by orion · 7 comments
Collaborator

Context

Step 3 of epic #63 (JavaScript back end), slice 2 of docs/design/JAVASCRIPT-BACKEND.md section 6: the rest of the language, part 1. Slice 1 (#678, PR #679) is on main: target browser-js, compiler/src/backend/javascript/, runtime/javascript/{core,int64}.mjs, tools/conformance.sh --js, tests/conformance/js.allow and the CI job conformance-js.

Source

Goal

The emitter handles Variant, Tag, Switch, FixedArray and Buffer (typed arrays), Read and Write through all PathSteps, Closure with the three captures, CallClosure, BoxNew, references and Lazy. Compiler only.

Acceptance criteria

  • tests/conformance/js.allow grows by the existing programs on enums, matching, closures and arrays that now pass under Node (tools/conformance.sh --js, same .expected, .stderr, .exit files as the C and VM legs). No program of the allow list is removed.
  • Each construct above has a conformance program or an existing one that exercises it; any gap gets a new program under tests/conformance with its expected files, passing on the C, VM and JavaScript legs.
  • The design record's slice table row 2 is marked done; docs regenerated as needed; tools/check-commits.sh clean; sh tools/gates.sh a and the conformance-js job green in forge CI.

Seed

Compiler only: no syntax change, no new native, no std name the compiler looks up. One PR; one Conventional Commit per logical change (feat(js): ...). Do not add a native to the kernel (K-natives are slices 4 and 5). Out of scope: slices 3 to 8, a minifier, source maps, torb test on browser-js.

Dependencies

#678 (slice 1, landed as PR #679).

Part of #63 (epic; do not close it).

## Context Step 3 of epic #63 (JavaScript back end), slice 2 of `docs/design/JAVASCRIPT-BACKEND.md` section 6: the rest of the language, part 1. Slice 1 (#678, PR #679) is on `main`: target `browser-js`, `compiler/src/backend/javascript/`, `runtime/javascript/{core,int64}.mjs`, `tools/conformance.sh --js`, `tests/conformance/js.allow` and the CI job `conformance-js`. ## Source - [JAVASCRIPT-BACKEND.md section 6](https://git.torb.dev/torbscript/language/src/branch/main/docs/design/JAVASCRIPT-BACKEND.md), row 2. ## Goal The emitter handles `Variant`, `Tag`, `Switch`, `FixedArray` and `Buffer` (typed arrays), `Read` and `Write` through all `PathStep`s, `Closure` with the three captures, `CallClosure`, `BoxNew`, references and `Lazy`. Compiler only. ## Acceptance criteria - [ ] `tests/conformance/js.allow` grows by the existing programs on enums, matching, closures and arrays that now pass under Node (`tools/conformance.sh --js`, same `.expected`, `.stderr`, `.exit` files as the C and VM legs). No program of the allow list is removed. - [ ] Each construct above has a conformance program or an existing one that exercises it; any gap gets a new program under `tests/conformance` with its expected files, passing on the C, VM and JavaScript legs. - [ ] The design record's slice table row 2 is marked done; docs regenerated as needed; `tools/check-commits.sh` clean; `sh tools/gates.sh a` and the `conformance-js` job green in forge CI. ## Seed Compiler only: no syntax change, no new native, no std name the compiler looks up. One PR; one Conventional Commit per logical change (`feat(js): ...`). Do not add a native to the kernel (K-natives are slices 4 and 5). Out of scope: slices 3 to 8, a minifier, source maps, `torb test` on `browser-js`. ## Dependencies #678 (slice 1, landed as PR #679). Part of #63 (epic; do not close it).
Author
Collaborator

[loop:torbscript] ready: filed just in time from the design record's slice table (row 2) after slice 1 landed.
next: ready

[loop:torbscript] ready: filed just in time from the design record's slice table (row 2) after slice 1 landed. next: ready
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261030 @anthropic:theorben until 2026-10-30T14:00:00Z

[loop:torbscript] claim implement by session:loop-torbscript-20261030 @anthropic:theorben until 2026-10-30T14:00:00Z
Author
Collaborator

[loop:torbscript] release implement by session:loop-torbscript-20261030: worker ended (gateway restart) after its work was pushed: PR #694 (head 97237e77, three commits, not draft, argus requested, Closes #684). CI pending.
next: waiting (CI and Argus review on #694)

[loop:torbscript] release implement by session:loop-torbscript-20261030: worker ended (gateway restart) after its work was pushed: PR #694 (head 97237e77, three commits, not draft, argus requested, Closes #684). CI pending. next: waiting (CI and Argus review on #694)
Author
Collaborator

[loop:torbscript] claim implementation (CI fix) by session:loop-torbscript-20261030 @anthropic:tkoehn until 2026-10-30T16:24:00Z
PR #694 (head 38b03abf): ci / commit messages fails; gates, tier A/B and the rest still pending.

[loop:torbscript] claim implementation (CI fix) by session:loop-torbscript-20261030 @anthropic:tkoehn until 2026-10-30T16:24:00Z PR #694 (head 38b03abf): ci / commit messages fails; gates, tier A/B and the rest still pending.
Author
Collaborator

[loop:torbscript] implementation (CI fix, checkpoint): ci / commit messages failed because style is not an allowed commit type; folded the format and budget commits into the test commit (2 commits now, rebased on main f0d81eb6). Next failure was tier A format --check on tests/conformance/js-variants-arrays.trb (case constructors on an assignment right-hand side are commands: Shape.Circle cell.value, Shape.Rectangle 2, 5); fixed and pushed d515ae9d. JS conformance under Node, playground, tier B and the cross-host C check were green on the previous head. Waiting for CI on d515ae9d.

[loop:torbscript] implementation (CI fix, checkpoint): `ci / commit messages` failed because `style` is not an allowed commit type; folded the format and budget commits into the test commit (2 commits now, rebased on main f0d81eb6). Next failure was tier A `format --check` on tests/conformance/js-variants-arrays.trb (case constructors on an assignment right-hand side are commands: `Shape.Circle cell.value`, `Shape.Rectangle 2, 5`); fixed and pushed d515ae9d. JS conformance under Node, playground, tier B and the cross-host C check were green on the previous head. Waiting for CI on d515ae9d.
Author
Collaborator

[loop:torbscript] implementation (CI fix): forge CI is green on d515ae9d (commit messages, tier A, tier B, JS conformance under Node, playground, cross-host C). Cause 1: the style commit type is not allowed by tools/check-commits.sh; the format and budget fixups are folded into the test commit, so the PR is now two Conventional Commits (feat(js), test(js)) rebased on main. Cause 2: tier A format --check flagged tests/conformance/js-variants-arrays.trb (case constructors as assignment values are written as commands); fixed with the CI-built torb format. The earlier playground failure did not recur. Worker usage: roughly 0.2M tokens. next: waiting (Argus review on #694)

[loop:torbscript] implementation (CI fix): forge CI is green on d515ae9d (commit messages, tier A, tier B, JS conformance under Node, playground, cross-host C). Cause 1: the `style` commit type is not allowed by tools/check-commits.sh; the format and budget fixups are folded into the test commit, so the PR is now two Conventional Commits (feat(js), test(js)) rebased on main. Cause 2: tier A `format --check` flagged tests/conformance/js-variants-arrays.trb (case constructors as assignment values are written as commands); fixed with the CI-built `torb format`. The earlier playground failure did not recur. Worker usage: roughly 0.2M tokens. next: waiting (Argus review on #694)
argus closed this issue 2026-10-30 15:22:50 +00:00
Author
Collaborator

[loop:torbscript] review: PR #694 merged by the merge gate, landed as d515ae9d on main. Worker usage about 0.2M tokens (estimate).
next: waiting (main CI on d515ae9d, then close)

[loop:torbscript] review: PR #694 merged by the merge gate, landed as d515ae9d on main. Worker usage about 0.2M tokens (estimate). next: waiting (main CI on d515ae9d, then close)
Sign in to join this conversation.
No labels
loop
ready
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
torbscript/language#684
No description provided.