A written key is a name
Amended 2026-11-12 — Linked modules. The boundary set below loses
use: a written module path is linked at check time, and its decided public schemes instantiate in the importer. It is not an undecided-shape boundary. The closed set isfrom-json,from-jsonl,from-json-at,from-csv,env,exarch-agents,exarch-pins,exarch-transcriptand_ed-state.envandfrom-csvremain checked boundaries; the key-form rules stand. See cacheless module loader.
Amended 2026-11-02: the checked IR is the calculus expresses the three reads as value-only
Prim::Indexoperations, not separate computation constructors. Their typing rules and surface key forms stand.
How a key is written decides what it reads. Quotes never decide a type. A written name reads a record field, a whole number a list element, and a computed string a map value. Data arriving from outside takes the type the script uses, checked at the door.
What was decided
- One rule per read.
$r[host],$r['user name'],$r["user name"]and$r[true]require[label: α | ρ].$xs[0]requires[α].$m[$k],$m["k$i"],$m[!{f}]and$m[$[…]]requireMap αand aStringkey. Each unifies immediately; none defers, defaults a shape or marks a variable weak. - Computed list positions use
nth.nth : ∀α. Int → [α] → F α, writtennth $i $xs, shares the list-index runtime checks. Written positions are whole numbers from zero; negative or fractional numerals are parse errors with a hint to quote a numeric field name. Paths and tilde words must be quoted as names too; a tag keys nothing. - Literals and patterns share the alphabet. Words and constant quoted
strings name fields, so
[a: 1, "b c": 2, 'd': 3]is a record. Any computed key makes the literal a map, its written keys becoming data.[:]is the empty map;[:, a: 1, b: 2]explicitly builds a map on written keys, with spreads permitted. Unkeyed entries and[:,]are refused. Patterns accept written keys only; a spliced one is refused. - Options and contracts follow suit. A constant
"dir":names awithinorgrantoption; computed names remain refused.return ["edit-mode": 'vi']is a record checked against the rc table, as quoted fields are against manifest and profile tables. env : ∀α. F αis a boundary.!{env}[HOME]checks the named field at that call;keys !{env}orhas !{env} Xuses a map. Every call has its own site. Values remain text.from-csv : ∀α. F [α]is a boundary. Label reads use record rows, computed reads map rows. Cells remain text; numeric use fails at decode, naming the column and line of use.to-csv : ∀α:data. [α] → writesaccepts record or map rows. Every row uses the same runtime carrier with the first row’s keys. Cells areString,Int,FloatorBool, rendered asstrrenders them. Any other cell is refused with its zero-based row index and key, before any bytes are written.- The boundary set is closed:
from-json,from-jsonl,from-json-at,from-csv,env,use,exarch-agents,exarch-pins,exarch-transcriptand_ed-state. - Key form is represented, not rediscovered.
IndexKeyin the AST andKeyin the IR areLabel,PositionorData. OnlyDatacontains an expression to traverse. Read errors are ordinary unification failures; their reasons and the heads found select the help, includingnthfor a computed list position (records and maps).
Why
A read with one typing rule preserves principal types. A record helper stays row-polymorphic and a map helper element-polymorphic, whether its body is inline or named. No disjunct must be chosen from later uses, so no index-made weakness or value-shape default is needed.
A boundary already knows both the incoming value and the type its script needs. Checking there preserves typed decoding before downstream effects without asking outside data to choose records or maps in advance.
Rejected
- An opaque
Jsontype: loses typed decoding before effects; exarch replies useFOValue, which also carries variants. $r.host: collides with interpolation such as"$f.txt".- Quotes marking data: makes
$x["HOME"]differ from$x[HOME]for no useful reason. - Keeping
Idxfor computed list positions: retains weak variables to serve four call sites;nthexpresses the operation directly.
Effect on earlier decisions
This supersedes the Lbl and Idx clauses and the CSV-row refusal of
operators are kinded, and the
index-made weakness and pending-label clauses of
a let generalises what is not weak.
It amends the closed set of
a boundary is checked against its type
and the env scheme of
ambient reads are builtins.
The kind discipline and boundary weakness remain unchanged.
Cite: docs/SPEC.md §4.5–4.7, §7.3, §17.3.