plum

#treesitter#compiler#wasm

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

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


88f1e29 — Peter John 2026-11-16T14:07:47+05:30
docs/plans: rules as objects that decide their own collisions
docs/plans/2026-11-13-std-game-review.md CHANGED
@@ -38,3 +38,6 @@ Events stay the only source of truth; std keeps held state as a pure fold of the
38
38
  - Also in the Elm task (user: "Yes"): geometry in std (`Vec2.near(other, dist)` or a Circle-to-Circle test) replaces Orbit Runner's `overlaps`; actors spawn themselves (`Orb.spawn(rng, near: ship)` returning the actor and the next Random) instead of the screen's `newOrb`/`newMine`; no `World` struct (removed on master by the user).
39
39
  - Done on `sl/elm`: `trait ScreenSlice<A>` is `update(self, a) -> Next<Self, A>` (default `Next(state: self)`), `subscriptions(self) -> List<Sub<A>>` (default empty) and `onPress`; `enum Sub<A>` = `OnFrame(fn(Float) -> A)`, `OnKeyDown(key, act)`, `OnKeyUp(key, act)`, `OnHeld(fn(Held) -> A)`, `OnWheel(fn(Float, Vec2) -> A)`, `OnPointerDown`/`Up`/`Move(fn(Vec2) -> A)`, read once a tick from the screen as the tick found it; `wants` is "subscribes to `OnHeld`"; `reduce`, `act`, `onKey`, `onPointer`, `held`, `tick`, `steps()` and the stepping phase are gone (a plain screen's tick is its `stepped`); every screen derives `stepped` without `Steps` (`Steps` on a screen is an error); `Vec2.near`; `Orb.spawn(rng, near, phase, tex)` and `Mine.spawn(rng, near, tex)` return `Rolled<..>` (positional: a fn call takes no named arguments). The uniqueness analysis resolves a call on a receiver of a bounded type parameter among the bound's implementers (`s.update(a)` met `Game.update`). Orbit Runner's checksum 946756219 to 818414470 (the restart tick no longer steers: subscriptions are read at the tick's start, while the run is over); orbit update 11.3 to 12.1 ms (subscription closures called indirectly each tick), the 10,000-actor scale benchmark unchanged.
40
40
  - After the Elm task (user: "After that benchmark and see if we have lost some perf please"): benchmark the tip against d8ce9bc7 (start of the no-globals queue, 2026-11-13) and a643bd8e (before the review batch) on a quiet machine: benchmarks/screen_views (Orbit Runner update/paint, 10,000 actors), benchmarks/run.py (compile time, wasm size, math/collections/map, game ticks), `plum test std` time; same toolchain, medians of 5; explain any loss and fix what is cheap.
41
+
42
+ ## Rules (user 2026-11-16: "Yes", before the benchmark)
43
+ Objects decide their own collisions (option A): `Meets<Other, A>` with `meets(self, other) -> Option<A>` on Orb (Caught(orb: id)) and Mine (Hit); `rules(self) -> List<A>` collects `..xs.filterMap(|x| x.meets(self.ship))`; `update` handles `Caught`; a counter-based `Random.at(seed:, tick:, salt:)` replaces threading `rng` (no Rolled/Caught accumulators, `deal` a plain map); `touches` in std from declared circle shapes; `Place` as a `Vec2` where that removes conversions. Option B (std contact search) not chosen.