dsl … -> T { … } eod: a block’s rows are a declared struct, matched by name, strictly, NULL only into T? (ADR-299 D15-D19)Open and answer this issue on GitHub.
blocked · opened 2026-10-06 · updated 2026-10-06 · 0 comments
#114 asked how a dsl block’s row type is made. ADR-323 answered how a grammar describes a type, and ADR-299 D12-D14 answered how the compiler-written row’s fields are named.
The owner then asked why a program cannot simply say which of its own structs a row is. The compiler-written row is a type of its own, and Nikaia’s structs are nominal (tried: a Person where a Contact is expected is NK1102).
dsl sqlite(schema: APP) -> Contact { … } eod, the arrow as in fn. Each row is a Contact. The grammar is not told about T.AS, a group field, or the block without -> T.extra_columns: true leaves extra columns unread.missing_fields: true makes a missing T? field null.Maybe(T) column goes only into a T? field.T? field.T? at run time makes execute fail with an error naming the field, the column and its table. A driver’s mistake is a named error, never a broken promise.T?, or a struct for a group.
Shared[T] included. Sharing is #475, after the MVP; the refusal can later become a permission.std::db’s).Records:
NK1218-NK1223.Prerequisite: meta::column and the compiler-written row (ADR-299 D2, ADR-323), which are not built yet.
-> Type after a dsl block’s build-time arguments and before {. Without arguments: dsl sqlite -> T { … } eod.T must be a struct the program declares; else NK1218.T?, or a struct (a group); else NK1218, also for Shared[T].NK1222, with help: AS, a group field, no -> T.NK1219, unless extra_columns: true.NK1220, unless missing_fields: true and the field is T?.Maybe(T) column into a non-? field, or a type that is not the field’s, is NK1221, with help: T?, COALESCE(…), WHERE … IS NOT NULL.extra_columns and missing_fields (both bool, default false) are taken by the compiler from a block with -> T and not passed to the grammar.NK1223.T directly.NULL for a non-? field fails execute with an error naming the field, the column and the table.T? field under missing_fields is null.-> Contact with email, name in reverse order builds, and the rows are Contact (pass one to fn send(c: Contact)).NK1218, NK1219, NK1220, NK1221, NK1222, NK1223 once, with its help.extra_columns: true builds past an extra column.missing_fields: true with a T? field gives null; with a non-? field it is still NK1220.a: Account beside b: Bank with a.id and b.id builds without AS.NULL for a NOT NULL-declared column: execute fails with the named error and does not crash.-> T, extra_columns: true is refused by the grammar as an unknown argument (ADR-299 D3).