Decision D002 · goal accepted; mechanism proposed
No separate low-level dialect
A record of the language's design, as it stood on 2026-11-18: written for the people who build Diaspar, and kept as it was written. Its code is a sketch, not a program of the site, and an older record may show syntax that a later one changed. It names files of the language's source, which is not public yet.
Status: accepted as a goal (2026-11-14); the restriction mechanism is proposed
Decision
The Diaspar runtime (allocator, reference counting, fiber scheduler, event loop, cycle collector) is written in ordinary Diaspar, compiled by the same compiler, and checked by the same checker. There will be no separate dialect like Pre-Scheme for Scheme 48, Slang for Smalltalk, or RPython for PyPy.
A restricted context still exists: some code runs where it must not allocate (inside the allocator), must not switch tasks (inside the scheduler), or may do almost nothing (in a signal handler). Every language has this. The proposal is to express such restrictions as properties of ordinary functions that the compiler checks transitively.
Example (sketch; syntax not settled)
;; src/std/rt/alloc.dias — the module std.rt.alloc
(use std.unsafe as: raw) ; unsafe operations only through an explicit import
(defn ^:no-alloc bump [size]
(let [p (raw.load-word heap-top)]
(raw.store-word heap-top (+ p size))
p))
;; calling a function that allocates from bump is a compile error
Why
- Ferron's experience. Its Rust runtime had to be moved through a separate "systems subset" (Ferron D92):
Ptr, atomics, the#[no_managed]and#[no_alloc]attributes, packages withsystems = true. It was retrofitted after the fact. - Separate dialects age badly. Pre-Scheme needed a 2024 grant to be restored. The Squeak VM is 2.56M lines of generated C. They start fast and are expensive to maintain.
- Working examples of one language with restrictions:
- Go: about 2.4k
//go:directives on runtime functions; - Jikes RVM / MMTk: a collector written in Java with structured raw-memory types, faster than the older collectors and with fewer bugs;
- Oberon and Virgil: the garbage collector is ordinary code, and unsafe operations come through
IMPORT SYSTEM.
- Go: about 2.4k
- The restricted context can be kept small. Its size is set by decisions made before the runtime: with no tracing collector (D004), no LLVM (D003), and no chain of previous binaries, only the allocator, signals, and fiber switching remain in it.
Rejected alternatives
- A separate dialect (Pre-Scheme, Slang, RPython).
- A runtime in another language (C, Rust): the path we are leaving.
unsafeblocks inside ordinary code, as in Rust: the trust boundary spreads through all code. Instead: a module, an explicit import, and checked function properties.
Resolved
The mechanism and the list of restrictions are decided in D026: inferred properties with attribute bounds, strict in the runtime and std.unsafe importers; no-managed, no-alloc, no-switch, signal-safe.
Former open questions
- Write restrictions as attributes (
^:no-alloc) or as effects (D005)? Effects give one mechanism for everything, but their checking is soft, and here it must be strict: insidestd.unsafeand the runtime a violation must be an error, not a warning. - The full list of restrictions:
no-alloc,no-switch(must not switch fibers),signal-safe, anything else.