plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


04de243 — Peter John 2026-11-06T10:57:29+05:30
plans: FBIP stage 1, keep the chain
docs/plans/2026-11-06-fbip-stage1.md CHANGED
@@ -75,8 +75,8 @@ e.g. `v = v.bumped()` in a `for` loop, with `bumped(self) = Cell(..self, n: self
75
75
  **LOC owned:** 180
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
- **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. `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
78
+ **Produces:** `Array.with` 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. in a loop on a fresh array, `a = a.with(i, i * 2)` 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
 
@@ -85,7 +85,7 @@ e.g. `Array.with`: `a = a.with(i, i * 2)` in a loop on a fresh array allocates n
85
85
  **Components:** 2
86
86
  **LOC owned:** 150
87
87
  **Tests:** fast
88
- **Consumes:** `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 (T4)
88
+ **Consumes:** `Array.with` 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 (T4)
89
89
  **Produces:** `fip fun` is a compile error, at the exact spot and giving the reason, when a spread or `Array.with` in that function isn't proved in place
90
90
  e.g. `fip fun f(a: Array[Int]) -> Array[Int] = { b := a; a.with(0, 1) }` errors at `a.with`, saying `a` is also held by `b`
91
91
  **Notes:** Check at the end of the pipeline, because the proof runs after fusion: the error comes from the driver with the node's span. Under `--no-fbip` or `--no-fusion`, `fip` isn't enforced, and say so. Calls from a `fip fun` to other functions aren't required to be `fip`, so it's a local check. Formatter (`format.scm`) and LSP keyword completion learn the keyword.