Language at a glance
Z uses a TypeScript-inspired surface with native, value-oriented semantics. Familiar punctuation is an on-ramp; it does not imply garbage collection, structural typing, truthiness, or JavaScript numbers.
Values and identities
Section titled “Values and identities”struct defines a value. class defines ARC-managed reference identity.
struct Note { id: u64; title: String; active: boolean = true;}
class Session { readonly id: u64;}
const note = Note({ id: 1, title: "Draft" });const session = new Session({ id: 1 });Struct defaults may be omitted and explicitly overridden. Classes use new so
heap-backed reference identity is visible at construction.
Typed errors
Section titled “Typed errors”Functions return success with return and typed failure with throw:
struct LoadError { code: i32; }
function load(id: u64): Note throws LoadError { if (id == 0) throw LoadError({ code: 1 }); return Note({ id, title: "Ready" });}
const note = try load(42); // propagate failureconst result = attempt load(42); // retain Result<Note, LoadError>try propagates through the function’s error channel. attempt materializes
the result for local handling.
Pattern matching
Section titled “Pattern matching”return match (result) { success(note) => note.id; failure(error) => -error.code;};Match is exhaustive and may produce an expression value. select supplies a
value to a local expression block; return always exits the enclosing function.
Native-sized types
Section titled “Native-sized types”Z uses explicit integer and floating-point widths (i32, u64, f32, f64),
plus usize and isize for target-sized values. boolean, String, cstring,
Option<T>, arrays, slices, maps, and sets provide the everyday foundation.