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

Language Guide Overview

Welcome to the Restrict Language guide. These pages describe the current v0.0.1 release-facing syntax, including its closed enum and static form slices, and mark future boundaries where they matter.

What You’ll Learn

Quick Example

record ReleaseSignal {
    score: Int32,
    passing: Boolean
}

fun summarize_release: (signal: ReleaseSignal) -> String = {
    signal match {
        ReleaseSignal { passing: true, score } => {
            "ready"
        }
        ReleaseSignal { passing: false, ..._ } => {
            "blocked"
        }
    }
}

fun main: () -> String = {
    val signal = ReleaseSignal { score: 92, passing: true };
    signal |> summarize_release
}

Key Concepts

OSV Syntax

Restrict uses Object-Subject-Verb call order. Arguments come first: value |> function, (left, right) function, and () function.

Affine Types

Heap-backed values such as strings, lists, records, and function values are affine by default. Copyable primitives such as Int32, Boolean, Float64, Char, and () can be reused.

Type-Directed Impl Functions

impl blocks define functions selected by the receiver type, but calls remain OSV. Use (receiver, args...) function_name, not object-style method calls.

Static Forms

Method-only forms express reusable requirements. Concrete records adopt a form with takes, and generic functions list bounds with <T of Form>. The compiler selects and monomorphizes every method call without runtime form objects.

Pattern Matching

match is also OSV: the value being matched appears before the match keyword, and each branch body is wrapped in braces. Closed user enums use qualified Type::Variant patterns and must be matched exhaustively.

Zero GC

Restrict targets deterministic memory management through compile-time checks and WASM-friendly data layouts.