plum

#treesitter#compiler#wasm

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

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


87cdfdc — Peter John 2026-11-04T10:41:14+05:30
docs: queue native inline variants before FBIP; FBIP waits for a benchmark
docs/decisions/2026-11-language-and-scene-decisions.md CHANGED
@@ -80,8 +80,16 @@ A record of the design decisions taken in the 2026-11-03/04 sessions, with the r
80
80
  - **Refinement (during the build):** "expression-bodied" allows leading pure local bindings (`x := e`) before one tail expression, with no `return`, loops or assignments, like `let ... in`.
81
81
  - **Plan:** `docs/plans/2026-11-03-language-restrictions.md` (in progress).
82
82
 
83
+ ## 8b. Next: native inline variants, then decide union enums
84
+
85
+ - **Finding:** most of the union-related complexity comes from how inline variants are implemented: each variant is secretly turned into a hidden record plus a union member (`hoistInlineVariants`). That produced the `List__Cons(Cons(..))` wrappers drive had to see through and the trait forwarder that dropped `own`. User-facing union enums (`enum X = A | B` of records) are a small part: in std only `JsonParse` uses one, plus about 20 examples.
86
+ - **Decision (user, 2026-11-04):** a simplification plan runs right after the language restrictions, before FBIP:
87
+ 1. compile inline variants natively (each variant a struct subtype of its enum: no hidden records, wrappers or forwarders) and delete the hidden-record lowering;
88
+ 2. then decide, with that measured, whether union enums stay as a thin feature or fold into traits. If they go, `JsonParse` becomes inline variants (`Parsed(value: Json) | Failed(pos, text)`); the Json parser itself stays as it is.
89
+
83
90
  ## 9. Next: no heap mutation at all (Koka-style FBIP)
84
91
 
92
+ - **Deferred (user, 2026-11-04):** FBIP waits until a benchmark has been done (after the restrictions and native-variants plans), so its value is measured before it starts.
85
93
  - **Decision (user):** after the restrictions, remove heap mutation entirely, in the spirit of Koka's FBIP ("functional but in-place").
86
94
  - Persistent `Slice`/`Map`/`Array`/`Buffer`: `xs.set(i, v)` returns the new collection and is written in place when the old one is provably unique.
87
95
  - Koka-style `fip` functions: a checked guarantee that every update is in place, a compile error otherwise.