series
Library extension: Series T — a bounded ring buffer for streaming analytics, financial-style indexing (0 = newest). A kernel-tier .ail module wrapping a RawBuf — pure AILang, no Rust intercepts, no C, no LLVM IR emission. Depends on the shipped raw-buf milestone (#7). Architectural anchor: design/models/0007-kernel-extensions.md § "Series as the first library consumer".
Scope — two steps
- Step 1 — primitive Series over {Int, Float}. Flat type-specialised RawBuf,
ownvalue-returns. The SMA worked example in 0007 §"Worked example" is the clause-1 acceptance fixture. Narrower than RawBuf'sparam-in{Int,Float,Bool}; Bool is free to add later, omitted from step 1 on purpose. - Step 2 — SoA record-of-series. A record-valued Series stored struct-of-arrays. Downstream of step 1; separate brainstorm.
Decisions carried in from the 2026-06-02 design discussion
- D1 — No 0008 return-side tail dependency. No Series operation returns a borrow:
new/pushreturn freshownallocations;at/len/total_countreturnownvalue copies. Borrow-returns are doubly unneeded — over a value typeborrowis a check error (0008 §3.2), and under SoA a materialised record has no contiguous object to borrow. The return-side escape/soundness pass (the "Iteration-totality story" milestone, #3) is therefore NOT a prerequisite. Series uses borrow parameters (already shipped + verified), never borrow returns. - D2 — No 0009 (explicit RC) dependency. Series rides today's universal-RC + uniqueness inference. A future 0009 cutover would migrate Series source nearly unchanged (annotation-only:
(con RawBuf a)→(box RawBuf a)). Series is corpus evidence for a 0009 decision (the single-owner workload 0009 bets on), not downstream of it. - D3 — Step-2 SoA strategy leans record-of-series composition. Bundle N primitive Series in an AILang ADT (e.g.
(ctor PVS (con Series Float) (con Series Int))), rather than 0007's RawBuf-internal record-element intercept. Keeps step 2 pure library-extension (zero Rust) and makes step-1 primitive Series the literal building block. To confirm at step-2 brainstorm; also decides the structural-vs-nominal record question forat's return type. - D4 — Efficiency: layout + read path optimal; two accepted deviations. The flat type-specialised buffer and the indexed-load read path are not improvable. Accepted costs: (a) two allocations (Series wrapper ADT + RawBuf slab) vs one — the price of library-extension over base-extension; (b)
pushin-place is uniqueness-inference-dependent, not by-type guaranteed. - D5 — clang is NOT a safety net for wrapper elision. Empirically verified (clang -O2 over
examples/box.ail): the RC heap allocation survives-O2. The constant flows through the store/load via constant propagation, butailang_rc_alloc/ailang_rc_decremain — opaque allocator (no allocator attributes on thedeclare), and LLVM has no generic refcount-elimination pass (Swift/ObjC-ARC do this with dedicated language passes, not the-O2pipeline). Wrapper elision is the AILang inference's job, pre-IR. Consequence:pushin-place must be measured (bench), not assumed — an explicit step-1 acceptance point.
No due date
100% Completed