plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
20de20e
— Peter John
2026-11-11T01:47:11+05:30
Backlog: rewritten, open items only
- docs/backlog.md +60 -95
docs/backlog.md
CHANGED
|
@@ -1,97 +1,62 @@
|
|
|
1
1
|
# Backlog
|
|
2
2
|
|
|
3
|
-
Open work,
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
| imperative `Actor` trait, `Stage`, `Text.text` | all / camera / text | the mutable scene, by design |
|
|
64
|
-
| game shells (`World` etc. in examples) | state, wasDown, … | host shell state |
|
|
65
|
-
| `Ship`, `Orb`, `Mine`, `Star` (games/pure) | clock, vx, vy | actor state changed in `act` |
|
|
66
|
-
|
|
67
|
-
## Smaller open items
|
|
68
|
-
|
|
69
|
-
- **Go-to-definition in the LSP is gone** (2026-11-06): it only ever handled inherited members, which went with inheritance. A real one is wanted once modules land.
|
|
70
|
-
- **Leaked `plum run --no-open` servers** (2026-11-06): a test using `compiler/game/tests/fixtures/host_fixture.plum` left servers running for hours. Not found; the likely cause is `serveStartsAndAnswersWithTheRightContentTypes` in `compiler/cli/tests/cli/game_web_test.rs`, which only kills its child on the success path (the other spawning tests use a kill-on-drop guard).
|
|
71
|
-
- **Locals named like functions, remaining cases** (found 2026-11-06, F-PUR-1 note, pre-existing, with or without fusion): in wasm-codegen, a flat local named like a free function traps or gives invalid wasm; a local in an embedded struct's `init` that captures a free call is silently wrong. The second goes away if inheritance is removed.
|
|
72
|
-
- **Pattern-shadowed parameter gives invalid wasm** (found 2026-11-06, pre-existing, with or without fusion): a parameter shadowed by a pattern and read in a sibling arm compiles to wasm that won't load. Details in the game engine run's note `F-T6-2`.
|
|
73
|
-
- **Closure self-call, still open** (`F-CLOSURE-1` fixed the typed-argument and arity checks; a self-call now errors in the checker when an argument does not fit a known parameter type). What stays: (a) a parameter with no declared type and no hint from a later call (`rec := |n| .. rec("x")` passed to `map`) has no type to check against; (b) `rec(None, [], n-1)` / `rec(Some(n), ..)` with untyped params still fail in codegen (invalid wasm or `type name 'Nil' is not yet supported as a value`), because the self-call's arguments are inferred with no expected type; checking them with the parameter as expected type fixes those but changes the wasm of programs that run today (e.g. a typed `Option[Int]` param called with `None`), so do it in a run that may re-baseline wasm; (c) a self-call from a nested closure (`outer := |n| inner := |m| outer(m-1) ..`) fails in codegen with `unknown function 'outer'`; (d) a typed declaration `f: fn(Int) -> Int := |n| ..` does not bind `f` inside its body; (e) a failed closure initialiser also reports a second `'rec' is not a function` at its first use.
|
|
74
|
-
- **LSP columns are bytes, not UTF-16** (phase 4, pre-existing): non-ASCII text before an error underlines the wrong range. Spans take tree-sitter byte columns.
|
|
75
|
-
- **Phase 4 workarounds still in place:** closure-hint twin mapping (`compiler/driver/src/lib.rs`, because `for` lowering numbers `pre` and the checked program separately) and `defaultSingleton` (`compiler/wasm-codegen/src/lib.rs`, because param defaults are never checked).
|
|
76
|
-
- **Unproven, not reproduced (phase 4):** a discarded speculative failure could leave a stale `err_pos` on a later error; `Unit` from a missing type might panic in `scratchTypeIdx` on some pattern shape.
|
|
77
|
-
|
|
78
|
-
- **Map as a balanced tree, and constant map literals** (user 2026-11-04, later) — reimplement `std/Map` as a persistent B-tree or AVL tree (a recursive enum, e.g. `Leaf | Node(left, key, value, right, height)`); keys need ordering instead of `Hashable`, iteration becomes sorted/deterministic. `[k => v, ..]` keeps desugaring to `Map.empty().set(k, v)...` (O(n log n)). Optional later optimisation: when every key in a literal is a compile-time constant, sort, dedupe and build the balanced tree directly at compile time.
|
|
79
|
-
- **List literal cost** — `[a, b, c]` desugars to `Cons(head: a, tail: Cons(..., Nil))`, O(n); revisit if `List` changes representation.
|
|
80
|
-
|
|
81
|
-
- **`List.length()` on a locally built list fails codegen** — `fun count() -> Int =` / `xs := List(1, 2)` / `xs.length()` gives `codegen: unknown method 'List.lengthFrom' (in 'count')`; the same call on a `List` parameter, or inside a `test` block, works. Also hit with a static `Hue.palette().length()`. Found drafting the kids' games; the user wants it fixed (with a regression test) before those games are built. Check whether the cleanup refactor already fixed it.
|
|
82
|
-
- **Spread from a field path** — `Stage(..w.stage, x: 1)` is rejected; only a plain variable can be a spread source. Worked around with small helpers in the pure game. (language-restrictions T14)
|
|
83
|
-
- **Fields declared inside `init` can't be `mut`** (`self.camX: Float = 0.0`) — such fields were moved into the record header. (T8)
|
|
84
|
-
- **Benchmark harness can't pass `--no-fusion`** — `compiler/game/web-test` compiles without flags, so fusion-off numbers can't be taken since the env var was removed. (T11)
|
|
85
|
-
- **`Orb`/`Mine` copy their shared `Node` per frame** in the pure game, because `Node`'s x/y/rotation stay immutable in std. Decide during FBIP. (T10)
|
|
86
|
-
- **A nested spread allocates in a trait step** (actor-trait task 7, 2026-11-09): `Bod(..self, at: self.at.moveTo(x, y))` with `at: Place` allocates a cell per step that FBIP doesn't remove (Ship.step in a probe: one `struct.new` with a nested `Pos` spread), so the scene benchmark's step workload ran 1.7x slower than with `x`/`y` fields and a `place()` that builds the `Place`. So std's actors (`Group`, `Box`, ui's `Button` and `Label`) and the games keep plain `x`/`y` fields (actor-trait task 8); a value `Place` in a unique field is now written into its old box, but the boxed field still costs the step, and removing that needs a layout change.
|
|
87
|
-
- **Struct fields have no defaults** (actor-trait task 6): the plan's `struct Place(x, y, scaleX: Float = 1.0, ..)` doesn't parse; std/game/scene/Place has `place.at(x, y)` and `place.turned(x, y, s, r)` instead.
|
|
88
|
-
- **A generic call's result pinned only by a later parameter** (actor-trait task 6): `firstOf(Holder.of(Box(id: 5)).same())`, with `firstOf(h: Holder[Int])`, still instantiates `Box[Unit]` and fails codegen ("Box[Unit] has no compiled method 'key' for a call on Thing[Unit]"); an annotated local (`h: Holder[Int] := ..`) works. Likewise `SceneTree.of(Group(..))` with nothing fixing `M` is a `SceneTree[Unit]`: annotate it.
|
|
89
|
-
- **Uniqueness precision** — `adv(Cell(..))` inlined into `main` reports "s used after its spread" although `s.x` is only read inside the spread value (a false "not in place"). (T10)
|
|
90
|
-
- **Pattern-casing hint for union members** — "did you mean Foo?" doesn't cover a lowercase name that spells a union member (lookup lives in `compiler/core/src/unions.rs`). (T1)
|
|
91
|
-
- **Constant `Anim` trees rebuilt every frame** in `games/functional/game_state_view.plum` (`renderTitle`, Ship render) — hoist them into `State` or constants. (F-T23-1)
|
|
92
|
-
- **Static subtree reuse** in functional scenes (build unchanging parts of a picture once). Deferred by the user as a later optimisation. (state-view parity plan)
|
|
93
|
-
- **Structural deep `==` for records** — user chose deep structural equality (like Rust `#[derive(PartialEq)]`), deferred before implementation; until then `==` on records is identity. (state-view parity T7)
|
|
94
|
-
- **Retire PureScene?** — after the component-style functional game, decide whether `std/game/pure` + `games/pure` stay. (Decision record §4b)
|
|
95
|
-
- **`adder(1)(2)`** (calling a returned closure directly) is not supported. (functional-gaps plan)
|
|
96
|
-
- **Fusion past a closure-spec copy on `Nil` miscompiles** — in `drive.rs` `quiet`, resolving `Nil.fold$c0(..)` to `List.fold$c0` (read-only) lets a value move past it, and codegen then fails with `unknown method 'List.fold$c0'` (5 `closure_spec_test` cases). `typeNameMethodKey` skips `$` copies until this is fixed.
|
|
97
|
-
- **Input model** — steps 1-3 built 2026-11-04 (typed `Msg` events for the functional style only); see [game-scene-styles.md](decisions/2026-11-game-scene-styles-analysis.md) section 6.
|
|
3
|
+
Open work on `simpler-language`, rewritten 2026-11-11. Only what is still open is here: finished and dismissed items were removed (history is in git and in `docs/plans/`). Numbers come from `docs/benchmarks/2026-11-11-simpler-language-before-after.md` unless a line says otherwise.
|
|
4
|
+
|
|
5
|
+
## Decided, not built
|
|
6
|
+
|
|
7
|
+
- **Compile-time layer** (`docs/plans/2026-11-09-comptime-generics.review.md`). The `<>` syntax, the trait list in `[]` and the trait jump table from that plan are done. Still to build: `@hasMethod`, `@hasField`, `@fields`, `@field`, `comptime if` and `comptime for`, `@compileError`, `@embedFile`, `@src`, constants computed while compiling, `comptime fun`, value generics and type aliases, default type parameters, `Option` of a reference as a nullable reference (no allocation for `Some`, allocation-free `for` loops), derives in std (`hash`, `eq`, `toStr`, `lerp`, JSON), replay checksums with snapshot and rewind, easing and tweens in `Anim`.
|
|
8
|
+
- **`Clickable` as a compile-time flag.** The pointer walk tests each node with a trait downcast (one tag check). Once the compile-time layer exists, compute "is clickable" once at spawn and store it in the node. Needs a node field `RoseTree` does not have.
|
|
9
|
+
- **Testing** (user: "All 3 please"): `group "name"` blocks with scoped helpers; compare-mode tests (one flag runs a test with and without fusion and in-place updates); property tests in std (`check(|a, b| a + b == b + a)` with generated inputs).
|
|
10
|
+
- **Optional or automatic actor keys.** Most actors need no `key`. Either a default `key() -> Option<Int>`, or ids handed out by the tree from a counter and stored in the node. Open: how a spawner learns its child's id.
|
|
11
|
+
- **Constant map literals.** `[k => v]` lowers to `Map.empty().with(..)`, O(n log n). When every key is a compile-time constant, build the tree while compiling.
|
|
12
|
+
|
|
13
|
+
## Performance
|
|
14
|
+
|
|
15
|
+
- **Compile time is worse than on 2026-11-10 morning**: 1.32x CPU for Orb Run (538 to 708 ms), 1.40x Balloon Pop, 2.0x for a small program, even after a 30% speed-up of the passes. Causes measured or likely: programs reach more std (+17% items for Orb Run), the in-place pass is now its own pass with its own re-check, the loader's threads add CPU. The program is still checked about 7 times per compile. Re-checking only changed functions was tried and dropped: type info is keyed by node id and instantiation numbering depends on whole-program order, so the output would change. Needs stable ids first. Pruning std before the first check fails because loop and `?` lowering add calls the raw program does not name.
|
|
16
|
+
- **`Map` insert allocates its whole path** (3.9x slower than the old hash table on raw sets and gets; 4.2x faster with 100 kept snapshots). Cell reuse for generic methods and a cheap `Int.compare` are being built on branch `perf/map-reuse`; update this line when it lands.
|
|
17
|
+
- **Closure calls are untyped.** A closure is held as `anyref`: each call does two casts and an indirect call, and building one allocates two objects. A typed closure struct per signature with `call_ref` would fix it. Indirect evidence: `cons_rec` (1.94 s) and `cons` without fusion (1.0 s) did not move.
|
|
18
|
+
- **A value struct inside an enum payload is boxed twice** (`Some(Pos)` allocates two objects). No measurement yet.
|
|
19
|
+
- **Scene tree with kept snapshots**: "60 kept" at N = 10000 costs 11 times a plain step. Ideas, all functional: a 32-way chunked vector for children instead of the sibling chain; skipping subtrees that cannot change; world transforms cached per node; reusing last frame's draw list when the root is the same object.
|
|
20
|
+
- **In-place updates still miss** 36 of Orb Run's 56 spreads. Reasons, by count: a value rebound by a pattern (8), the receiver read again after a method call (5), a shared value (4), a field passed on without being written back (4), an argument passed from inside a closure (4).
|
|
21
|
+
- **Static functions are slower than free functions** (0.78 s against 0.57 s on `benchmarks/static_calls`).
|
|
22
|
+
- **Smaller codegen items**: match arms test then cast (`br_on_cast` would do one check); the inliner skips leaves that use their locals (`unbox.*`); every struct has its own empty supertype; purity treats every closure-taking function as impure, so pipelines fuse only after closure specialisation.
|
|
23
|
+
- **The hover lookup costs about 3% per tick** (the context holds the tree being stepped).
|
|
24
|
+
- No evidence either way, so not planned: unchecked reads in `for` over a `Slice` (checked `at` showed no cost).
|
|
25
|
+
|
|
26
|
+
## Bugs
|
|
27
|
+
|
|
28
|
+
- **A line that starts with an operator joins the line above.** `m := n * 2` followed by a line `|x| x + m`, or by `-x`, is read as one expression. The grammar's `body` rule needs real newline separators between statements (a large grammar change).
|
|
29
|
+
- **Negative literal patterns** (`-1.5 =>`) are a parse error.
|
|
30
|
+
- **Paths are named relative to the working folder** (`compiler/core/src/loader.rs`, about line 370): compiling from another folder embeds absolute paths in the wasm, so builds are reproducible on one machine but not across machines. The LSP's "elsewhere" check depends on the current behaviour.
|
|
31
|
+
- **`replay::tests::eachExampleGameReplaysARecordedRun` failed twice**, cause unknown. It records with a seed from the clock. A failure now saves its recording to `target/replay-failures/` and names the first differing draw call.
|
|
32
|
+
- **`pow` with a fractional exponent** is `exp(y * ln x)`: 23 ulp at `10.0.pow(10.5)`, 323 ulp at `10.0.pow(299.5)`. Needs a port of fdlibm's `e_pow.c`.
|
|
33
|
+
- **`m := [[], []]`** reports three errors where one would do.
|
|
34
|
+
- **A web `plum build -o`** leaves stale assets from a previous build in the folder.
|
|
35
|
+
- Small ones: after a duplicate-variant error the old type mismatch may still follow; the "function used as a value" error can misfire on a parameter of type `fn(Io, ..)` named like an extern; `Option.eq` on function payloads reports the enclosing function's line; LSP syntax diagnostics do not carry the hint lines; LSP completion panics are not caught; warnings in the grammar's `scanner.c`.
|
|
36
|
+
|
|
37
|
+
## Language gaps
|
|
38
|
+
|
|
39
|
+
- **Type arguments on a static call's type** (`T<Int>.make()`) are not supported, and type arguments in an expression must be on one line.
|
|
40
|
+
- **Struct field defaults** (`struct Place(x: Float, scaleX: Float = 1.0)`) and **`fn` types as type arguments** (`Slice<fn(Int) -> Int>`): both need grammar changes.
|
|
41
|
+
- **No private members.** `Decimal`'s big-number helpers are public statics (`Decimal.bigAdd`).
|
|
42
|
+
- **No warnings.** A `hit` method on an actor that does not list `Clickable` is silently never called. Open question below.
|
|
43
|
+
- **A nested closure cannot call the outer self-calling closure** (a checker error today), and a self-calling closure whose parameter has no type and no later hint cannot be checked.
|
|
44
|
+
- From master's gap list, not yet looked at here: `..` in patterns, tests that expect a crash.
|
|
45
|
+
|
|
46
|
+
## Std
|
|
47
|
+
|
|
48
|
+
- `Str.runeAt` returns an `Option` although `at` crashes everywhere else. Open question below.
|
|
49
|
+
- `Map.getEntryAt` is the `Option` form of `entryAt`; the name was an agent's choice.
|
|
50
|
+
|
|
51
|
+
## Candidates from other branches (not started, not decided)
|
|
52
|
+
|
|
53
|
+
- From `self-hosting`: a WASI preview 2 target (`plum compile --target wasi`); running tests on the standalone wasmtime CLI and dropping the embedded host; `plum chrome` with a browser runtime for parity checks; `plum dump-ast` and its invalid-parse fixtures.
|
|
54
|
+
- From `master`: typed `Assets` with `Assets.none()` for tests; compiling a trait's default method once instead of once per implementer, if that is what happens here (not checked); the wasm-gc dispatch write-up.
|
|
55
|
+
|
|
56
|
+
## Open questions for the user
|
|
57
|
+
|
|
58
|
+
1. Should the checker gain warnings, starting with "`hit` without `Clickable`"?
|
|
59
|
+
2. `Str.runeAt`: keep the `Option`, or crash like `at` and add `getRune`?
|
|
60
|
+
3. `Map.getEntryAt`: keep the name?
|
|
61
|
+
4. Which performance item first after the Map work: compile time, typed closure calls, or the scene tree with snapshots?
|
|
62
|
+
5. Rerun the before/after benchmark on an idle machine? The 2026-11-11 run had a load average of 5 to 19 from other work.
|