Issue #525: Compiled build-time code: NK1244 for a run that stopped, NK1165 retired, NK1102 bounds, NK1127 without a workshop

Open and answer this issue on GitHub.

ready · opened 2026-10-07 · updated 2026-10-09 · 1 comment

Where this comes from

#468 builds ADR-321: a comptime, or a computed default, is compiled and run instead of interpreted. While building stages 1–4, the building session asked four questions in #468’s comments (2026-10-05). None is answered, and none had an issue or a label of its own. They are gathered here so #468 can stay ready for its build steps (stage 3, stage 5) while these wait for the owner.

What happens today for each case is a placeholder, chosen so that it is a one-line change.

1. Which code reports a build-time run that stopped?

comptime C = sq(100000) with an i32 sq runs and aborts on the overflow, as the program would. The build reports it as NK1152: C stopped while the program was built: attempt to multiply with overflow., with the caret on the line.

Options:

2. NK1165 (an index into an Array at build time)

Part III still describes NK1165. With compiled build-time code, xs[7] on an Array[i64, 3] is the program’s own abort, with the runtime’s message (index out of bounds: the len is 3 but the index is 7), reported under question 1’s code.

Options:

Today the build-time and run-time words agree, which is ADR-321 D1’s point.

3. A bound that is not a whole number the build knows

comptime(steps: one()), or a negative bound: neither ADR-321 D11 nor Part III says what this gets.

The build gives NK1102 for now: steps takes a whole number the build knows, and this is not one. Nothing runs.

Options:

4. A check without a workshop

The library API (check::check) can be called without a place to compile in; every CLI build has one. Once the interpreter’s call path is gone (#468 step 9), what does such a check answer for a comptime that calls something?

Until this is answered, the interpreter stays for exactly this case, and #468 step 9 waits.

What needs the answers

Comments

keywan-ghadami, 2026-10-09

Decided (0.0.720, a1b1f3e)

What was checked first. I ran each case on the current compiler:

Decision. The owner accepted all four recommendations:

  1. A build-time run that stopped gets a code of its own: NK1244, in the run time’s words, at the line where it stopped (ADR-321 D16). NK1152 keeps the rule and the bounds: steps, memory and depth.
  2. NK1165 is retired. A folded index past the end stops with NK1244 and the run’s words (D17, ADR-311 D4 changed).
  3. A steps/ram bound the build does not know, or one not above 0, stays NK1102, with one sentence for each case (D18).
  4. (a) A check with no place to compile refuses with NK1127 and a note, and never leaves the value open (D19). In addition: spike #556 asks whether the compiler can make a workshop for itself, in memory if need be.

Specification: Part II 10.2, Part III C.3.

To build

  1. NK1244. Move the compiled run’s abort from NK1152 to NK1244 and keep the message. Budget, memory and depth stay NK1152.
    • Tests: sq(100000) with i32 gives NK1244. fib(50) gives NK1152.
  2. Retire NK1165. The checker’s fold of XS[7] reports NK1244 with index out of bounds: the len is 3 but the index is 7. Remove a_build_time_index_is_not_there.
    • Test: the literal and the function path give the same code and the same words.
  3. NK1102, two sentences. Not a known number: steps takes a number the build knows. At or below 0: steps takes a number above 0. The same for ram.
    • Tests: steps: one(), steps: -5, ram: 0.
  4. No workshop gives NK1127 with the note this check has no place to compile build-time code in. After that, #468 step 9 (removing the interpreter’s call path) is unblocked. Tests that check a comptime with a call either get a workshop or expect this refusal.
    • Test: check::check without a workshop on comptime C = f().

Generated by Claude Code

Back to Open Issues