Standard Library & Runtime

Runtime Behavior

Canonical API, behavior, evidence, and constraints for Runtime Behavior.

Runtime policy fixes observable values, ordering, faults, rendering, numeric boundaries, and host-effect limits while allowing implementations to choose different internal representations.

Canonical contract

int is signed 64-bit with checked overflow, truncating division, signed remainder, and faulting invalid operations. float is IEEE-754 binary64. Strings compare exact scalar sequences. Collections preserve the specified insertion/production order. Option, Result, nominal values, templates, Bytes, BigInt, Decimal, JSON, dates, hashes, and formats use the contracts named by their inventory signatures.

Public surface

Runtime helpers are implementation details, not extra public names. An output target may use its own records, tasks, helpers, persistent data, or native libraries as long as the program's visible behavior stays the same. Rendering is stable for supported values and preserves nominal constructor identity where specified.

Observable behavior

Faults abort evaluation and are distinct from Option/Result. Concurrent arm faults abort the expression; timeout fallback handles timeout only. Array direct index, zero integer division, zero dynamic range step, checked integer overflow, negative dynamic integer exponent, and runtime match miss are named fault sources. Safe library alternatives such as get return Option. Collection callbacks and snapshots follow fixed order.

Current support

The interpreter, Rust output, and Python output are tested together across the currently supported runtime families. Compression remains limited to the Rust-backed library path, and concurrent task ordering is intentionally unspecified.

Constraints and exclusions

Do not infer host integer overflow wrapping, host hash order, locale-dependent formatting, implicit Unicode normalization, catchable faults, general finalization after abort, scheduling order, ambient host authority, performance guarantees, or availability of an unlisted runtime helper. Different lowering is permitted only behind equal observable results or a loud decline.

Worked example

TOPAZ
function safeRead(values: Array<int>, index: int) -> Option<int> {
    return values.get(index)
}

let rounded = Math.round(2.5)
let item = safeRead([10, 20], 9)
print("{rounded}:{item}")