plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
a277678
— Peter John
2026-11-04T21:12:14+05:30
docs: run A: one for form, no Seq
docs/plans/2026-11-04-language-simplification-a.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- Grammar edits: regenerate with `tree-sitter generate --disable-optimizations` (the default optimizer silently breaks unrelated parses); update corpus fixtures.
|
|
13
13
|
- Gate for every task: workspace test binaries pass and `plum test plum-std plum-examples` passes (678 today; the count may change only by tests this plan deletes or adds, each listed). Wasm bytes may change.
|
|
14
14
|
- Never run `plum format` on real files. Don't commit.
|
|
15
|
-
-
|
|
15
|
+
- One loop form (user 2026-11-04): `for x := range v` — Int counts, any type with `next(self) -> Pair[T, Self]?` iterates. No Seq (deleted). `?.` and all error syntax stay.
|
|
16
16
|
- Rulings from the user (2026-11-04): list literal syntax `[a, b, c]` (brackets at expression start; `[]` stays generics after a type name), a pure parser desugaring to `List.empty().append(a).append(b).append(c)` — no `init` method on List or Map (both `init`s are deleted); `[]` is `List.empty()` (element type from the annotation or use); a Map literal `["a" => 1, "b" => 2]` desugars to `Map.empty().set("a", 1).set("b", 2)` (coordinator default, user may change); `Seq` becomes a struct holding a `next` step closure returning `T?`, and `for x := s` loops over anything with `next(self) -> T?`.
|
|
17
17
|
|
|
18
18
|
## Task graph
|
|
@@ -111,21 +111,21 @@ e.g. `Seq.range(0, 10).filter(|n| n % 2 == 0).take(2).fold(0, |a, n| a + n)` ->
|
|
|
111
111
|
**LOC owned:** 80
|
|
112
112
|
**Tests:** slow
|
|
113
113
|
**Model:** sonnet
|
|
114
|
-
**
|
|
115
|
-
|
|
116
|
-
e.g. `for x :=
|
|
114
|
+
**Produces:** the ONE loop form `for x := range v`: `v: Int` counts 0..v (today's behaviour); any other `v` whose type has `next(self) -> Pair[T, Self]?` iterates (null = done, else (value, rest)); every other `for` form (generator calls, chain forms) becomes a parse/check error naming `for x := range v`
|
|
115
|
+
e.g. `for i := range 3` binds 0, 1, 2
|
|
116
|
+
e.g. `for x := range [5, 6]` binds 5, 6 (List gets `next`)
|
|
117
117
|
**Review Focus:** fusion: `fusion_alloc_test` and List-chain fusion still pass; report any lost fusion with numbers.
|
|
118
|
-
**Test code:** for_next_test for the e.g.
|
|
118
|
+
**Test code:** for_next_test for the e.g. lines + a user struct with `next`; gates pass.
|
|
119
119
|
|
|
120
120
|
### T4 std and examples off generators · Complexity 4 · Est. context 45k
|
|
121
|
-
**Owns:** plum-std/Map.plum, plum-std/Int.plum, plum-std/List.plum, plum-examples/functional.plum, plum-examples/sequences.plum
|
|
121
|
+
**Owns:** plum-std/Map.plum, plum-std/Int.plum, plum-std/List.plum, plum-std/Seq.plum, plum-examples/functional.plum, plum-examples/sequences.plum, plum-examples/control_flow.plum, plum-examples/arrays.plum
|
|
122
122
|
**Components:** 1
|
|
123
123
|
**LOC owned:** 100
|
|
124
124
|
**Tests:** slow
|
|
125
125
|
**Model:** sonnet
|
|
126
|
-
**Consumes:** `for x :=
|
|
126
|
+
**Consumes:** the ONE loop form `for x := range v`: `v: Int` counts 0..v (today's behaviour); any other `v` whose type has `next(self) -> Pair[T, Self]?` iterates (null = done, else (value, rest)); every other `for` form (generator calls, chain forms) becomes a parse/check error naming `for x := range v` (T10)
|
|
127
127
|
**Produces:** none
|
|
128
|
-
**Test code:** no `fun*`/`yield` left
|
|
128
|
+
**Test code:** Seq.plum deleted (user: no Seq); `Int.until/to/downTo/stepBy` return a small `Range(start, stop, step)` struct with `next`; List gets `next`; every loop in std/examples is `for x := range v`; no `fun*`/`yield`/Seq left; all gates pass. Ruling: also owns plum-std/Seq.plum, plum-examples/control_flow.plum, plum-examples/arrays.plum.
|
|
129
129
|
|
|
130
130
|
### T5 error forms and `=` inventory · Complexity 4 · Est. context 45k
|
|
131
131
|
**Owns:** plum-examples/errors.plum, docs/plans/2026-11-04-language-simplification-a.inventory.md
|