plum

#treesitter#compiler#wasm

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

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


0240e61 — Peter John 2026-11-06T18:52:35+05:30
Docs: async is not planned
docs/backlog.md CHANGED
@@ -27,7 +27,6 @@ Open work, in the order the user queued it, plus smaller items found during buil
27
27
 
28
28
  ## Planned, not yet placed in the queue
29
29
 
30
- - **Async, after the imperative versus functional comparison** (user 2026-11-06): one event loop owned by the host. Games use commands as values. HTTP servers use code that reads as blocking, with no `async` keyword. The candidate implementation is CPS applied only to functions that reach a waiting host call, found through `Io`. See docs/decisions/2026-11-simpler-language-notes.md.
31
30
  - **Language ideas to discuss later** (user 2026-11-05: "add them ideas to be discussed later"):
32
31
  - **Single inheritance** — DECIDED 2026-11-05, built in run C (T11).
33
32
  - **One way to build a game** (user 2026-11-05, idea): collapse the three styles (std/game/imperative Scene, functional FunctionalScene/Ui, pure PureScene/SceneInput) into one; the game-entry shape (below) is chosen with it.
docs/decisions/2026-11-simpler-language-notes.md CHANGED
@@ -118,24 +118,6 @@ Nothing needs to change now. Plum relies on wasm-gc, and the imperative versus f
118
118
 
119
119
  If the comparison shows pauses or allocation costs that hurt, the next step is a small prototype on its own branch.
120
120
 
121
- ## Async: one event loop, no `async` keyword
121
+ ## Async: not planned
122
122
 
123
- Agreed direction, not built. It comes after the imperative versus functional comparison.
124
-
125
- There's one event loop, owned by the host, and two ways of using it:
126
- - **Games use commands as values.** `update` returns requests, the host runs them, and results come back as messages. This needs no compiler work, and recording the messages suits replay and deterministic simulation.
127
- - **Servers and CLI tools use code that reads as blocking.** `db.find(io, id)?` just looks like a call. There's no `async` or `await`.
128
-
129
- **Candidate implementation: CPS chosen by `Io`.** A function without `Io` can't wait, so the compiler can see which functions might. Because it compiles the whole program, it can narrow that to the functions that reach a host call that really waits. Only those get turned into continuations. Wasm stack switching is the alternative.
130
-
131
- **What "zero cost" means here:**
132
- - Pure code pays nothing.
133
- - `io` code that never waits, such as drawing or printing, pays nothing.
134
- - Code that waits pays for a heap allocation, because its state must outlive the call. That can be one allocation per task rather than one per wait, by compiling a task into a single state struct as Rust does. Plum's per-type generics suit that.
135
- - The event loop itself has no language cost, since wasm is single-threaded and the browser or host already runs one.
136
-
137
- **Open problems:**
138
- - A stored closure that takes `Io` has no visible sign of whether it waits, so it would have to be treated as if it might.
139
- - Non-tail recursion that waits keeps its frames on the heap.
140
- - `mut` fields can still change between waits, though never at the same instant.
141
- - Code size has to be measured.
123
+ Nothing is being built (user, 2026-11-06). No `async` keyword, no fibers and no CPS in the compiler. If a program needs to wait on something later, a single event loop or polling should be enough, the way `Input` is polled today.