Program Structure

Forbidden & Deferred Forms

Replace familiar but unsupported syntax with canonical Topaz forms.

Refer to this guide when topaz check rejects syntax originating from JavaScript, Python, Rust, or an earlier Topaz draft. Topaz accepts the canonical forms below. Most familiar spellings have direct current replacements; the remaining feature families are listed as deferred.

Check a program that uses the current forms

Save this as forbidden-deferred.tpz:

TOPAZ
let mut count = 0
let values: Array<int> = [1, 2]
let transform: (int) -> int = value => value + 1

match values {
    case [head, ..tail] => {
        count = transform(head) + tail.length
    }
    case [] => {
        count = 0
    }
}

print("{count}")

Check and run it:

BASH
topaz check forbidden-deferred.tpz
topaz run forbidden-deferred.tpz

The output is:

Output
3

This single program demonstrates current binding order, named collection types, callable types, lambdas, and list-rest patterns.

Replace the spelling, not the meaning

If you triedUse instead
mut let count = 0let mut count = 0
count++ or count--count = count + 1 or count = count - 1
[T] in a typeArray<T>
function(T) -> U in a type(T) -> U
args: ...T...args: T
[head, ...tail][head, ..tail]
An anonymous function (...) { ... }A lambda such as value => value + 1
Backticks or ${value}Double quotes and {value} interpolation
String indexing or .lengthtext.scalars() and Array operations
async or awaitExplicit concurrent execution with a declared timeout where that model fits

Module imports and exports follow fixed syntax rules. Use explicit member imports and inline export declarations from Modules & Visibility. Do not use use, string or template module paths, export lists, wildcard exports, re-exports, or export-site renaming.

Invalid spellings above are shown as text reference rather than valid Topaz examples. Run topaz check before selecting a backend target. The shared checker rejects these forms at the language boundary rather than asking a generated target to infer their meaning.

Deferred forms and current alternatives

Some rejected forms have current replacements. Other features remain deferred because their semantics are outside the current language specification. Current code should use the documented alternatives; the listed feature families await a future language decision.

The unavailable feature families include grapheme-cluster and direct string-slicing syntax, HTML and user-defined template tags, broader or higher-rank generic constraints, recursive type aliases, broad protocol dispatch, package re-exports, general iterable spread, asynchronous cleanup, async/await, fault catching, panic/throw/catch keywords, and optional-property pipe syntax.

Rust ownership and receiver tokens such as &self, &mut self, Vec<T>, and use crate:: belong in labeled interop specifications. Standard Topaz uses module-level impl Name, built-in collection types, canonical imports, and its own record-update forms.

Start with Syntax at a Glance for current forms. Use Operators & Expressions for operator corrections and Modules & Visibility for the exact program-structure surface.