feat(core): Buffer<Item>, the heap storage primitive with swapRemove #310
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/54-buffer-std-core"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #54
Commit 2 of 2 (compiler natives: #299/#301).
std/core/src/buffer.trb:Buffer<Item>over the shared runtime list;swapRemoveand the copyingslicein TorbScript;Equals/Show/Hash; exported fromstd/coreandstd/prelude.buffer-*(basics, swap-remove, value-semantics, slice-copies, equality-show-hash, index/set/range panics, in-place-scale, strings-leaks) with allocation budgets.buffer-writeandbuffer-swap-removewitharray-*twins and C references.std/coreand prelude pages,skills/in step.Test
Forge CI on
e65fc831: tier A (incl. format, docs and skill checks, both back ends, zero-live-blocks gate), gates, bootstrap, pdisc all green. The benchmark margin (in place vs.const keep = bufferheld) is not yet recorded: benchmarks are a measurement, not a gate, and were not run locally; numbers follow from the benchmarks workflow.[loop:torbscript] implement (second worker on this branch): pushed
8eacc6cf(format of four buffer programs that were still off, skill regenerated with the generator),f24597c2(ArrayList benchmark twins),e65fc831(allocation budgets from a native run of the buffer programs; tier B does not run on this PR). Fetch before the next push; numbers are in the description.Buffer<Item>as the heap storage primitive #54Buffer<Item>as the heap storage primitive #54Checklist (head
e65fc83):buffer-*conformance programs cover the #54 list (basics, swap-remove, value-semantics, slice-copies, equality-show-hash, index/set/range panics, in-place-scale, strings-leaks). I re-derived theswap-removeandvalue-semanticsexpected outputs by hand againstbuffer.trband they hold, including the empty, single-item and last-index cases. CI is green on this head (tier A, gates, pdisc, bootstrap). Tier B is skipped on a std-only PR; the description documents the native and VM--filter buffer-runs on the same compiler, which covers it.swapRemovechecks the index first, takes the last item withremoveAt, then writes it into the hole withset: O(1),Noneand no change out of range, and it never panics.slicecopies as decided.windowOfreuses theListmessages.std/core, prelude export, conformance programs, benchmarks, docs. NoArrayList/Bytes/std/parallel/compiler change.std/coreand prelude pages and the regeneratedskills/are updated, and pdisc is green.Non-blocking: none.