Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FAQ

Is Restrict production-ready?

Not yet. The documentation targets a focused v0.0.1 release surface. It is useful for compiler development, language experiments, WebAssembly examples, and release-surface validation, but several major design areas remain reserved.

Why does Restrict reject function(args)?

Restrict is OSV-only. Put the value or argument tuple first:

value |> function
(left, right) combine
() make_default

This rule is strict so examples, diagnostics, and generated code all use the same call shape.

Why does main return get dropped during execution?

main keeps its source result type in generated WebAssembly, but program-style execution uses a no-result _start wrapper only when main takes no parameters. The wrapper initializes the default arena, calls $main, drops any returned value, and resets the arena.

If a host needs a return value, expose a separate scalar pub fun or export fun.

Can I export strings or records to JavaScript?

Not directly in v0.0.1. Host-visible exports are limited to scalar monomorphic values: Int32, Int64, Float64, Boolean, Char, and ().

Use records, strings, lists, Option, and Result internally, then export a scalar wrapper while the composite host ABI is still being designed.

Does browser support require a JavaScript backend?

No. Restrict source continues to compile to WebAssembly. JavaScript can load the Wasm module and provide DOM, Fetch, event, or platform imports as a thin host adapter. That adapter may eventually be generated by Restrict tooling; it is not a second language backend.

Can a Restrict application run without JavaScript?

Yes, within the current boundary. Generated programs use basic WASI Preview 1 imports and can be hosted by a native WASI runtime. Full command applications still need documented bindings for arguments, standard input, environment, filesystem, clocks, and related capabilities.

Browsers do not currently expose the DOM directly to Wasm, so Web UI programs still need a host adapter. Docker and containerd may package and execute a WASI artifact, but do not define a separate Restrict target or ABI.

Are Temporal Affine Types included?

No. Temporal Affine Types are planned and reserved, but they are outside the default v0.0.1 gate.

Are user-defined enums supported?

Yes, in the v0.0.1 compiler. The supported slice is closed, non-generic, and non-recursive; variants have zero or one payload and use qualified Type::Variant constructors and exhaustive patterns. A custom enum can be the error in Result<T, CustomError>.

pub enum is source-module-only and creates no host enum ABI. Generic or recursive enums and postfix ? propagation are not implemented yet.

What should documentation examples use?

Use:

val value = 42
mut val counter = 0
value |> function
(left, right) combine
RecordName { field: value }

Avoid:

let value = 42
val mut counter = 0
function(value)
RecordName { field = value }

Where should I start?

Read the Quick Start, then the Language Guide. Use the Online Compiler for short examples and the local CLI/Warder flow for project builds.