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
| Surface | v0.0.1 status |
|---|---|
| OSV-only calls | Use `value |
| Scoped verb clauses | A callable’s final function parameter may open a typed scope such as values map { it + 1 } or `(values, 0) fold { |
| Completed-value application | Values 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 scopes | context 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 bindings | Immutable bindings use val; mutable bindings use mut val. |
| Built-in generic values | List<T>, Option<T>, Result<T, E>, and concrete Range<Int32> are supported. |
| Fixed-length arrays | Source-level Array<T, N> is supported. Compiler-internal wildcard lengths are not a public Array<T, 0> contract. |
| Built-in container behavior | Built-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 imports | Dotted source imports, named imports, wildcard imports, and whole-module imports are supported. String imports and aliases are not. |
| Records | Records are supported inside Restrict programs and across source modules. Direct host-visible record exports are not. |
| Scalar function exports | Concrete non-generic pub fun and export fun are supported when every host-visible parameter and result is scalar. |
| Scalar top-level constants | Immutable top-level literal constants can be exported when their ABI is Int32, Int64, Float64, Boolean, Char, or (). |
| Program entry | Zero-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 target | Restrict 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:
| Surface | Current status |
|---|---|
| Closed user enums | Supported when non-generic and non-recursive. Every variant has zero or one payload. |
| Constructors and patterns | Use qualified Type::Variant names. Constructors use OSV order and matches are exhaustive. |
Custom Result errors | A closed enum can be the error in Result<T, CustomError>. Error propagation still uses explicit match; postfix ? remains future work. |
pub enum | Exposes the enum namespace across Restrict source modules only. Enum values have no direct host-visible WebAssembly ABI. |
| Method-only forms | form Name contains fully typed method signatures. Forms are non-generic and have no associated types or default bodies. |
| Concrete record adoptions | RecordName takes FormName supplies every method body for one concrete, non-generic record. A takes declaration itself is not public. |
| Form bounds | Generic functions use <T of Form> or <T of First + Second>. Calls are statically checked and monomorphized to direct adoption methods. |
pub form | Exposes the form contract across Restrict source modules. It does not create a host-visible form object or dynamic dispatch ABI. |
Standard Display | display, 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
| Surface | Reason |
|---|---|
| Traditional calls | Restrict is OSV-only. Use (1, 2) add or `value |
| String imports and import aliases | v0.0.1 keeps the source module surface dotted and direct. |
| Re-exports | Import declarations stay at the source module boundary. |
| Exported generic functions | Host-visible generic ABI rules are still design work. |
| Exported composite host values | Strings, records, lists, Option, and Result do not have a direct host ABI yet. |
| Computed or mutable exported globals | Exported 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
takesdeclarations - dynamic form dispatch and runtime form objects
- first-class values for the polymorphic
display,print, andprintlnbuiltins - 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.