← writing

move, borrow, mixed

summary: three laziness modes for join reactions. the runtime knows them. the surface still does not expose them.

ThePlatform ThePlatform: proving the shared runtime in production work: 2022 technical note

Core idea: ThePlatform's ownership model had to distinguish moved, borrowed, and mixed values because language-level reuse and runtime-level memory safety were the same problem.

The runtime knows whether a reaction's bound values are moved, borrowed, or mixed. The surface does not yet ask the user. That is the gap.

In kernel/o/reactor/src/reaction.rs the discipline is a field:

pub enum Laziness { Move, Borrow, Mixed }

pub struct Reaction {
    pub laziness: Laziness,
    pub borrow:   Vec<bool>,
    // ...
}

Today the compiler infers the Laziness and borrow mask from how the body uses the bound names. That works most of the time. The corner cases land as runtime bugs in the analysis - reactions that wanted to peek but ended up popping, with stateful, racy, do-not-actually-pop guards in the body. Inferred discipline gives you those guards. User-authored discipline does not.

The change I keep thinking about, and have not committed to, is making peek-versus-pop a binder-site declaration. The runtime is ready for it. The mask is already there. What I have to design is the syntax that makes the user's intent unambiguous - and that is the part where moving from inferred to authored stops being a refactor and starts being a language decision.