plum

#treesitter#compiler#wasm

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

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


7a071c1 — Peter John 2026-11-05T10:53:44+05:30
decisions: single inheritance (one embedded struct = base), built in run C
docs/backlog.md CHANGED
@@ -21,7 +21,7 @@ Open work, in the order the user queued it, plus smaller items found during buil
21
21
  ## Planned, not yet placed in the queue
22
22
 
23
23
  - **Language ideas to discuss later** (user 2026-11-05: "add them ideas to be discussed later"):
24
- - **Single inheritance only** (user: "makes sense"). After run C only the FIRST embedded struct makes a subtype; later embeds only copy fields/methods. Drop the later embeds and use a plain field (`ship: Ship`) instead: one rule, and most of the field splicing in `embeds.rs` goes.
24
+ - **Single inheritance** — DECIDED 2026-11-05, built in run C (T11).
25
25
  - **One way to set up a struct.** Drop `fun init(self)` in favour of field defaults + ordinary constructor functions. `init` is what forces the Boxed layout and the EmbedInit machinery in `ctors.rs`. Main user: `std/game/imperative/Scene.plum`.
26
26
  - **From Pony:** (1) a two-level ownership model (unique + mutable vs shared + immutable, like Pony's `iso`/`val` with `consume`) as the visible face of FBIP, replacing `mut` fields — take into the FBIP plan; (2) no ambient authority: no globals, a function without `Io` provably does no IO — what deterministic sim needs; (3) Pony partial functions (`?`, no error value) argue for `Option` + `?` as the common path and `Result` only when the error value matters. Not copied: union types, structural interfaces, six capabilities.
27
27
 
docs/decisions/2026-11-language-and-scene-decisions.md CHANGED
@@ -124,6 +124,7 @@ Gleam's data model (immutable records with `T(..x, f: v)` updates, custom types,
124
124
  The user decided to simplify the language before the compiler is refactored further (node ids, file splits):
125
125
 
126
126
  - **Traits are removed.** Their role goes to records embedding records, like inheritance: a record that embeds another is a subtype of it, is accepted wherever the base is, and may `override` base methods; calls on a base value dispatch to the override. The scene graph's `trait Actor` becomes a base record.
127
+ - **Single inheritance** (user 2026-11-05, "Yes please", built in run C): a struct embeds at most one struct, and that embed is always its base (subtype). A second embed is an error pointing at a plain field. Copy-only embedding is gone.
127
128
  - **Union enums are removed.** `enum X = A | B` over records goes; `JsonParse` and the union examples become inline-variant enums (`A(..) | B(..)`), compiled natively as struct subtypes of the enum.
128
129
  - **Why:** both features are the main sources of the compiler's extra lowering passes (trait stand-ins in embeds/ctors, hidden records for inline variants, union_lower and the address-keyed union plan that forces repeated type checks). Removing them first shrinks every later cleanup phase and simplifies codegen.
129
130
  - **Order:** right after compiler-cleanup phase 3a; then explicit function generics; then cleanup 3b, 4, 5, 6.