1b2d23ec42
Comprehensive usability re-test of the RawBuf kernel extension in natural LLM-author decompositions the prior field test (0058) did not exercise: a Float RawBuf in a user ADT read through two borrow helpers, a Bool flag buffer filled with a computed value, an Int fib buffer whose fill reads its own writes plus two composed borrow summaries, and a forbidden core-primitive element. All three working fixtures build, run to expected values, and report live=0 across Float/Bool/Int widths — the core RawBuf surface (borrow-helper composition, fill loops, RawBuf-in-ADT, element widths) genuinely holds together. Orchestrator triage corrected the fieldtester's run, which executed a stale target/release/ail (built before the #50 fix). Every outcome was re-verified against a fresh build: - F2 (bare RawBuf ADT field unresolved) — RETRACTED: a stale-binary false positive. On a fresh build the bare name resolves in every configuration (ctor name == or != type name; builds/runs live=0). The #50 fix is correct and general. - F7 (NEW, issue #51) — a `check`-clean program crashes `build`: a buffer whose element type is never observed by a later get/set defaults its element to Unit in monomorphisation and hits an unregistered `RawBuf_new__Unit` intercept. Affects a legitimate `RawBuf<Int>` used only for its size AND a forbidden locally- constructed element. Root: the `(new T ...)` desugar drops the explicit element annotation; honouring it reverses the milestone's § Term::New desugar decision, so it routes through brainstorm. - F8 (process) — the field test ran stale; the fieldtester agent now builds from the current tree before running (plugin fix). F1 (spec_gap) resolved here: the design ledger's §Series substrate ctor wrote the storage field `(own (RawBuf a))`, which does not parse (`own` is fn-param/ret only). Rewritten to the verified-authorable `(con RawBuf a)`. The rest of the §Series listing is illustrative and its element- less `(new RawBuf lookback)` construction is entangled with #51; a full compile-verification of that listing belongs with the Series-substrate work. F5 (param-in rejects a forbidden core primitive, message names the set) and F4/F3 (borrow composition; substrate composite) carry on. F6 (param-in set rendered as a Rust-debug list) filed as #52. refs #7
58 lines
2.2 KiB
Plaintext
58 lines
2.2 KiB
Plaintext
; Fieldtest raw-buf comprehensive .2 (Axes 1+2+3 — Bool element width
|
|
; through a fill loop, then counted via a borrow helper).
|
|
;
|
|
; Task an LLM author is naturally given: "mark which of the numbers
|
|
; 0..N are even in a flag buffer, then count how many flags are set."
|
|
; A flat Bool RawBuf is the natural storage for a flag/bitset array.
|
|
;
|
|
; The prior field test only stored a single Bool at a literal index
|
|
; (rawbuf_3_sensor_pair). This drives the i1/i8 Bool packing edge
|
|
; through a (loop ...)/recur FILL of runtime length N (one RawBuf.set
|
|
; per slot, the stored value being a *computed* Bool — the result of
|
|
; `eq (i % 2) 0`), and reads the flags back through a `borrow` helper
|
|
; (`count_set`) that drives off RawBuf.size and accumulates an Int.
|
|
;
|
|
; This stresses:
|
|
; - Bool stored/loaded across a loop, not a literal set — does the
|
|
; i1/i8 round-trip hold when the value is computed, not a `true`
|
|
; literal?
|
|
; - A borrow-receiver helper over a Bool buffer (the #46 fix on the
|
|
; Bool width).
|
|
; - `RawBuf.get` of a Bool used directly as an `if` condition inside
|
|
; the count loop.
|
|
;
|
|
; N = 6 -> flags for 0,1,2,3,4,5 -> even at 0,2,4 -> 3 set.
|
|
; Expected stdout: "3".
|
|
|
|
(module rbx_2_bool_sieve
|
|
|
|
(fn mark_even
|
|
(doc "Set slot i to (i is even) for i in 0..n. Linear own->own.")
|
|
(type (fn-type (params (own (con RawBuf (con Bool))) (con Int)) (ret (own (con RawBuf (con Bool))))))
|
|
(params buf n)
|
|
(body
|
|
(loop (b (con RawBuf (con Bool)) buf) (i (con Int) 0)
|
|
(if (app ge i n)
|
|
b
|
|
(recur (app RawBuf.set b i (app eq (app % i 2) 0))
|
|
(app + i 1))))))
|
|
|
|
(fn count_set
|
|
(doc "Count the set flags, reading the Bool buffer through a borrow.")
|
|
(type (fn-type (params (borrow (con RawBuf (con Bool)))) (ret (con Int))))
|
|
(params buf)
|
|
(body
|
|
(loop (acc (con Int) 0) (i (con Int) 0)
|
|
(if (app ge i (app RawBuf.size buf))
|
|
acc
|
|
(recur (if (app RawBuf.get buf i) (app + acc 1) acc)
|
|
(app + i 1))))))
|
|
|
|
(fn main
|
|
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
|
(params)
|
|
(body
|
|
(let buf (new RawBuf (con Bool) 6)
|
|
(let buf (app mark_even buf 6)
|
|
(app print (app count_set buf)))))))
|