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

v0.0.1 Release Surface

This page records the public surface that v0.0.1 documentation, examples, and release-surface tests should agree on. LANGUAGE_SPECIFICATION.md remains the authoritative language specification; this page is the shorter release contract.

Supported

Surfacev0.0.1 status
OSV-only callsUse `value
Scoped verb clausesA callable’s final function parameter may open a typed scope such as values map { it + 1 } or `(values, 0) fold {
Completed-value applicationValues produced by match, then, blocks, and completed clauses may continue through direct OSV, pipe, named scoped verbs, or an anonymous exact-once unary scope such as `value {
Typed context scopescontext Name declares typed fields. with Context { bindings } { body } binds them for one lexical body, and nested scopes compose. Function-level context annotations and temporal lifetime scopes remain future work.
val / mut val bindingsImmutable bindings use val; mutable bindings use mut val.
Built-in generic valuesList<T>, Option<T>, Result<T, E>, and concrete Range<Int32> are supported.
Fixed-length arraysSource-level Array<T, N> is supported. Compiler-internal wildcard lengths are not a public Array<T, 0> contract.
Built-in container behaviorBuilt-in map, filter, and fold use compiler-supported container behavior for current built-ins. The internal Container associated-type machinery is not source-visible.
Source importsDotted source imports, named imports, wildcard imports, and whole-module imports are supported. String imports and aliases are not.
RecordsRecords are supported inside Restrict programs and across source modules. Direct host-visible record exports are not.
Scalar function exportsConcrete non-generic pub fun and export fun are supported when every host-visible parameter and result is scalar.
Scalar top-level constantsImmutable top-level literal constants can be exported when their ABI is Int32, Int64, Float64, Boolean, Char, or ().
Program entryZero-argument main is the executable source entry point. The generated _start export is a no-result wrapper that calls $main, drops any result, and resets the default arena. A parameterized function named main remains a normal function and does not emit _start.
Compilation targetRestrict source compiles to Core WebAssembly. The current program profile uses basic WASI Preview 1 imports; browser JavaScript is host glue rather than a JavaScript backend.

Scalar Host ABI

The current host-visible ABI is intentionally narrow:

Int32   -> i32
Int64   -> i64
Float64 -> f64
Boolean -> i32
Char    -> i32
()      -> no payload

Use scalar wrapper functions when a program computes with records, strings, lists, Option, or Result internally but needs to expose a stable host entry.

record Score {
    base: Int32,
    bonus: Int32
}

fun total_score: (score: Score) -> Int32 = {
    score.base + score.bonus
}

export fun exported_score: () -> Int32 = {
    val score = Score { base: 40, bonus: 2 };
    score |> total_score
}

Static Enums and Forms

The v0.0.1 release includes closed user-defined enums and a narrow static form system without widening the default host ABI:

SurfaceCurrent status
Closed user enumsSupported when non-generic and non-recursive. Every variant has zero or one payload.
Constructors and patternsUse qualified Type::Variant names. Constructors use OSV order and matches are exhaustive.
Custom Result errorsA closed enum can be the error in Result<T, CustomError>. Error propagation still uses explicit match; postfix ? remains future work.
pub enumExposes the enum namespace across Restrict source modules only. Enum values have no direct host-visible WebAssembly ABI.
Method-only formsform Name contains fully typed method signatures. Forms are non-generic and have no associated types or default bodies.
Concrete record adoptionsRecordName takes FormName supplies every method body for one concrete, non-generic record. A takes declaration itself is not public.
Form boundsGeneric functions use <T of Form> or <T of First + Second>. Calls are statically checked and monomorphized to direct adoption methods.
pub formExposes the form contract across Restrict source modules. It does not create a host-visible form object or dynamic dispatch ABI.
Standard Displaydisplay, print, and println accept <T of Display>. Scalar built-ins adopt Display; user records opt in explicitly. These compiler-reserved call targets are direct-call-only in the initial slice. eprint and eprintln remain String-only, and print_int / print_float remain compatibility helpers.

Rejected With Explicit Diagnostics

SurfaceReason
Traditional callsRestrict is OSV-only. Use (1, 2) add or `value
String imports and import aliasesv0.0.1 keeps the source module surface dotted and direct.
Re-exportsImport declarations stay at the source module boundary.
Exported generic functionsHost-visible generic ABI rules are still design work.
Exported composite host valuesStrings, records, lists, Option, and Result do not have a direct host ABI yet.
Computed or mutable exported globalsExported top-level bindings must be immutable scalar literal constants.

Reserved For Later

  • Temporal Affine Types
  • associated types, generic forms, and default form methods
  • generic, conditional, or enum takes declarations
  • dynamic form dispatch and runtime form objects
  • first-class values for the polymorphic display, print, and println builtins
  • generic or recursive user enums and variants with more than one direct payload
  • direct host WebAssembly ABI for user enum values
  • postfix ? error propagation
  • direct generic or composite host ABI
  • WebAssembly Component Model and WIT binding generation
  • general WASI filesystem, network, HTTP, and async bindings
  • direct portable browser DOM interfaces

Keeping these boundaries explicit is important: Restrict can evolve without silently promising unstable host layouts or unfinished syntax.