Skip to content

top-level val as compile-time value; --eval prints vals; Region pure at compile time - #41

Merged
vic merged 1 commit into
mainfrom
toplevel-val-2
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
toplevel-val-2

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

A top-level val x: T = e is a compile-time value. --eval now prints every top-level val, and no longer evaluates nullary defs.

  • Parser: val x: T = e at top level, with the type required. It becomes Ast.DVal, a nullary fn whose body is e.
  • Ty: the body is checked in compile-time mode, and no El or C is produced for it. Region is supplied by the compiler at compile time: no capability is passed for a callee's inferred {Region} row or for a written {r: Region} binder. Any other effect is error[unhandled-effect], since nothing outside a top-level val can handle it.
  • Purity: Region is no effect for purity (written binder and inferred row). Opening an Arena still is one, because its handler calls the runtime.
  • Not yet: run-time code that names a top-level val is error[val-at-run-time]. Emitting the value as C static data is a later rung.
  • Tests: tests/s2/eval/* are rewritten to val. The old neg tests eff_pure and pure_region asserted "Region is an effect" and are replaced by eval/region (rg1 3, rg2 4); the old compiler rejects that file with impure-call. New: neg/val_effect and neg/val_runtime. README updated.

Local gate, run alone: 203 ok, 0 FAIL.

…ry top-level val; Region is no effect for purity (the compiler supplies it at compile time); run-time code naming a val is error[val-at-run-time] for now
@vic
vic merged commit 05b9c1d into main Nov 9, 2026
3 checks passed
@vic
vic deleted the toplevel-val-2 branch November 17, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant