Entails
Browse documentation

Runtime and reference semantics

The parser accepts these forms. The schedulers and ownership checker are design work.

Parallel functions

@runtime(asynchronous)
parallel function load_certificate(location: Text) -> Text:
    return wait read_certificate(location)

@runtime(threaded)
parallel function verify_certificate(source: Text) -> ProofOutcome:
    return check_certificate(source)

The return type describes the completed result. Calling a parallel function schedules a task and returns a typed handle. wait consumes that handle and yields its result or propagates its failure. The @runtime annotation selects the scheduler at compile time. The functions called in the example stand for application or library functions.

Runtime Scheduling Typical work
asynchronous Cooperative tasks suspend on an event loop. wait yields control while its task is pending. I/O and orchestration
threaded Tasks run on a bounded worker pool. wait suspends the task and frees its worker. CPU-bound proof search, checking, or evaluation

Both modes use structured tasks. A parent owns its tasks until it joins them. A task failure cancels its siblings and the runtime waits for their cleanup before leaving the scope. Scheduling order may vary. Pure tasks with the same inputs have the same result. Proofs about elapsed time or scheduling need their own cost model. Machine clocks count native transitions.

Values and borrows

function inspect(borrow tape: Tape) -> TapeSymbol:
    return first_symbol(borrow tape)

function rewrite(borrow mutable tape: Tape) -> NaturalNumbers:
    return overwrite_guard(borrow mutable tape)

function inspect_input(input: Tape) -> TapeSymbol:
    return inspect(borrow input)