From cfe8124cc393f44f1bc2882aaff54ff5ea60505d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 18:57:41 +0200 Subject: [PATCH] Rename addField to gatherField and reachMemo to renderCounts, and list every shared name left --- data.go | 2 +- graph.go | 6 +++--- struct.go | 6 +++--- todo.md | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/data.go b/data.go index 08dab0a..c49c23c 100644 --- a/data.go +++ b/data.go @@ -218,7 +218,7 @@ func checkScope(s nodeScope) error { // the walk. Its walks terminate only where nothing renders itself, so run it over a // loaded tree after checkNoCycles. func checkRenders(s nodeScope) error { - mem := reachMemo{} + mem := renderCounts{} if err := s(func(path string, n node) error { return repeatCheck(path, n, mem) }); err != nil { return err } diff --git a/graph.go b/graph.go index 0ff962f..9c017ce 100644 --- a/graph.go +++ b/graph.go @@ -169,9 +169,9 @@ func pathLeaves(n node, tail []string) []node { return out } -type reachMemo map[node]int +type renderCounts map[node]int -func (m reachMemo) renderCount(n node) int { +func (m renderCounts) renderCount(n node) int { if r, done := m[n]; done { return r } @@ -191,7 +191,7 @@ func (m reachMemo) renderCount(n node) int { // repeatCheck bounds the renders a repeat multiplies to along any root-to-leaf // path, so nested repeats cannot build what one repeat may not. // docs/decisions.md#the-repeat-cap-bounds-renders-not-bytes -func repeatCheck(path string, n node, mem reachMemo) error { +func repeatCheck(path string, n node, mem renderCounts) error { if t, ok := n.(*template); ok && t.repeat > 1 && mem.renderCount(n) > MaxRepeat { return fmt.Errorf("%s: repeat %d multiplies to %d renders along one path, above the maximum %d", path, t.repeat, mem.renderCount(n), MaxRepeat) } diff --git a/struct.go b/struct.go index 193255a..51f69e6 100644 --- a/struct.go +++ b/struct.go @@ -123,19 +123,19 @@ func (sc *structCompile) spend(label string) error { return fmt.Errorf(`%s: the struct fields reach more than %d structs; leave a struct field unfilled with fake:"-"`, label, maxStructs) } -// gatherFields gathers the fields of struct type t, which sits at index within c.t. +// t sits at index within c.t. func (c *structFields) gatherFields(t reflect.Type, index []int) error { for i := 0; i < t.NumField(); i++ { sf := t.Field(i) sf.Index = append(index[:len(index):len(index)], i) - if err := c.addField(sf); err != nil { + if err := c.gatherField(sf); err != nil { return err } } return nil } -func (c *structFields) addField(sf reflect.StructField) error { +func (c *structFields) gatherField(sf reflect.StructField) error { tag, tagged := sf.Tag.Lookup("fake") elem := structOf(sf.Type) switch { diff --git a/todo.md b/todo.md index 78b582a..e8b008c 100644 --- a/todo.md +++ b/todo.md @@ -20,8 +20,9 @@ Self-sufficiency 5.6), every seat capped by Locality or Self-sufficiency. This round, in order: - Rename the shared names left that name two things, per the decision "One name, one - meaning": judge each of `check`, `draw`, `drawn`, `head`, `key`, `name`, `named`, - `names`, `null`, `number`, `record` and `variant`. + meaning": judge each of `check`, `children`, `column`, `columns`, `draw`, `drawn`, + `fields`, `format`, `head`, `index`, `key`, `n`, `name`, `named`, `names`, `null`, + `number`, `op`, `reads`, `record`, `root`, `row`, `t`, `variant` and `whole`. - Run the nine-seat panel again and file what it names here. ### Data