plum

#treesitter#compiler#wasm

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

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


a19ade2 — Peter John 2026-11-16T13:11:19+05:30
docs/plans: the Elm-style screens task (update, subscriptions, stepped as a helper, std geometry, actors spawn themselves) and the benchmark after it
docs/plans/2026-11-13-std-game-review.md CHANGED
@@ -30,3 +30,10 @@ Events stay the only source of truth; std keeps held state as a pure fold of the
30
30
  ## Chosen (user 2026-11-16)
31
31
  - Building: R1 items 1+2 (done cfbc7a67), R2 item 3 + input addendum, R2b derived `stepped` (user: "Yes derived stepped is good"): a `[Steps]` trait on a screen or actor makes the compiler generate `stepped`/child stepping from Actor / List<Actor> / Option<Actor> fields at compile time; per-field pause by an attribute (e.g. `@stepsWhen(!self.over)`); a hand-written `stepped` still wins (done on `sl/steps`: `trait Steps` in std/game/View, `@stepsWhen(cond)` before a field, core/steps_derive.rs). Then R3 items 9-11 (done on `sl/cleanup`: `Game.onDemand` kept as std's one copy, `Frames.onDemand` removed; `SizedTile` moved to its test; `Replay.ticks` and the `Ticker`'s `played` are `List`s, the kit's recording a value; `[Steps]` steps a `List<View>` field with `Views.stepIn`, so `CrowdScreen` derives; `[Show]` (std/Str) derives `toStr`, the games' action enums list it; the games: `primitive Arena`/`Sheet`, `Blinks` and `holdStill` moved to the tests, `Hue.All` a const list, `Balloon` built by name with field defaults (`Balloon.at` gone), `Orb` and `Mine` hold their `Motion` (`motion()`, `put`, `create` gone); not done: a std `Body`, since the bounce is the game's rule and `Motion` is that body; the `PlayAgain` indirection kept).
32
32
  - Waiting: Key enum, one time model, Setup value, typed navigation.
33
+
34
+ ## Elm-style screens (user 2026-11-16: "Yes the elm syle looks good")
35
+ - One entry point: `update(self, a: A) -> Next<Self, A>` replaces `reduce`/`act` (and games' `followed`/`advance` splits).
36
+ - `subscriptions(self) -> List<Sub<A>>` replaces `onKey`, `onPointer`'s key-like uses, `held` and `tick`: `OnFrame(|dt| Tick(dt))`, `OnKeyDown(key, act)`, `OnKeyUp`, `OnHeld(|h| ..)`, `OnWheel`, list items allowed (`if !self.over then OnHeld(..)`); presses stay declared on views (`Presses<A>`, `Button`).
37
+ - No separate stepping phase: the game sends the frame as an action; the derived `stepped` stays as a callable helper (`Tick(dt) => self.stepped(dt).rules()`), `[Steps]` dropped on screens (derived for every screen), kept opt-in for actors; `@stepsWhen` stays.
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
+ - 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.