feat(lang): 27.3 - a reducer on a table's row: reducer T in S.table on A, @Target, Row<T>, @RowVerb, @Column

An action names one row of a ludic.base Table<T> by its handle, in a field marked @Target, and
`reducer Deer in Herd.deer on Spook(r: mut Row<Deer>, n: Noise, a: Spook)` runs once, for that row
alone (the table may sit down a path, S.w.tab). The drain resolves the handle (tb_row) and hands the
reducer a Row<T> - new in ludic.base: tb, row, h, rec - that the queue keeps, one per row reducer,
filled in place, so a targeted action allocates nothing; a stale handle runs nothing, and
LUDIC_ACTIONS_LOG=1 prints a line for it (@alloc_ok). Row reducers order among an action's by their
state's name, then the table's path.

Checked at compile time (actions_rows.ludic): the row reaches r.rec and r.h only - r.tb / r.row
refused, the view never assigned, stored, copied or handed on except to a @RowVerb (a function of
the record's own module taking Row<T> first; any other function taking a row is refused); a field
marked @Column (a table column mirrors it) is not written through r.rec; only the module owning the
state declares a row reducer; one @Target, an int, per action; the states between the row and the
action are read. `mut` is allowed on a Row<T> parameter.

ludic schema's code section gains row_reducers (record, table, state, action, target, predicted,
net, module, at) and row_verbs (name, record, module, at), and every action its target; row
reducers are left out of `reducers`. ludic deps and ludic-lsp name a row reducer
`reducer Deer in Herd.deer on Spook`. vocab: @Target, @Column, @RowVerb; docs/language pages;
LANGUAGE.md "A reducer on a row"; examples actions/rows and ten rejects; test.ludic feat, reject and
schema cases (not run); changes/row-reducers.md. Reseeded; bootstrap-cfree fixpoint holds (307497
lines); Maroon Lake's `ludic build --check` is clean against this tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 16:14:59 +03:00
parent d22abae476
commit ab0b84b87e
37 changed files with 125923 additions and 110956 deletions

View file

@ -12,6 +12,8 @@ function parse_component() -> Node {
var is_frame = false # @frame — a fn stored here runs every frame (25.2)
var cap = 0 # @max(n) — this list never holds more than n (25.5a)
var fat = -1 # its attributes, for the schema (attrs.ludic)
var is_target = false # @Target — an action's field naming a row (27.3)
var is_column = false # @Column — a field a table's column mirrors (27.3)
while is_op("@") { # one or more, on its line or the lines above
pi += 1
let ann = eat_id()
@ -20,6 +22,11 @@ function parse_component() -> Node {
if fat < 0 { fat = at_group() }
at_push(fat, ann, "[]", null, 0)
}
else if (ann == "Target") or (ann == "Column") {
if ann == "Target" { is_target = true } else { is_column = true }
if fat < 0 { fat = at_group() }
at_push(fat, ann, "[]", null, 0)
}
else if ann == "owns" { # @owns(PhysShape) — this field holds a handle its record owns (25.5e)
eat_op("(")
g_own_pending = eat_id()
@ -49,6 +56,7 @@ function parse_component() -> Node {
let f = node(N_FIELD); f.s = eat_id(); eat_op(":"); f.ty = ptype()
f.at = fat
if is_frame { push(g_frame_fields, `{n.s}.{f.s}`) }
if is_target or is_column { rr_field_attr(n.s, f, is_target, is_column) }
if cap > 0 { push(g_cap_keys, `{n.s}.{f.s}`); push(g_cap_vals, cap) }
if g_own_pending != null { push(g_own_type, n.s); push(g_own_field, f.s); push(g_own_kind, g_own_pending); g_own_pending = null }
if is_op("=") {