plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
2606ba6
— Peter John
2026-11-06T10:54:54+05:30
plans: FBIP stage 1, T4 example
docs/plans/2026-11-06-fbip-stage1.md
CHANGED
|
@@ -76,7 +76,7 @@ e.g. `v = v.bumped()` in a `for` loop, with `bumped(self) = Cell(..self, n: self
|
|
|
76
76
|
**Tests:** fast
|
|
77
77
|
**Consumes:** the proof covers method `self` and typed receivers, including overrides, `x = x.m(..)` hand-over in loops and fields, and functions that return their unique argument; `tests/fbip/` holds aliasing tests (T3)
|
|
78
78
|
**Produces:** `Array.with(self, i, v) -> Array[T]` returns the array with one element changed, in place when the receiver is proved unique and through a copy otherwise, with no cost for the check at runtime
|
|
79
|
-
e.g. `a = a.with(i, i * 2)` in a loop on a fresh array allocates nothing per step, shown by `--explain-fusion` and a byte-count or allocation test
|
|
79
|
+
e.g. `Array.with`: `a = a.with(i, i * 2)` in a loop on a fresh array allocates nothing per step, shown by `--explain-fusion` and a byte-count or allocation test
|
|
80
80
|
**Notes:** Works for flat-struct element arrays too: `Array[Vec2]` is stored field by field. A proved site compiles exactly like `Array.set`. Out-of-range behaves as `set` does.
|
|
81
81
|
**Test code:** aliasing tests for arrays: alias then `with`, the original is unchanged; array in a struct field; array returned from a helper; `Array[Vec2]`. An `opsOf`-style wasm test that a proved site has no `array.copy`, and an unproved one does.
|
|
82
82
|
|