Docs · Appendix

Glossary

Every term these docs lean on, in one place. Each entry is a working definition — the link goes to the guide or reference page that owns the full story.

_ (underscore) — the inference placeholder, with two roles. In a type or known-argument slot it means "solve this for me": fn inc(x: i32) _, max(_, 1, 2), _{ x: 1, y: 2 } (04 — Functions and closures, 11 — Known values and generics). In a pattern slot it matches anything and binds nothing: Rect(w, _) (06 — Pattern matching). It is not the switch catch-all — that is any.

allocator — a value that hands out memory. The Allocator interface (from @mem) requires alloc(size, align) and free(buf); the typed new/delete ride along as interface methods. Nothing in Vyi allocates unless you call one — a function that allocates takes an allocator, one that doesn't, can't. (09 — Pointers and memory)

any — two related uses. As a pattern, the deliberate catch-all arm of a switch — the only way to satisfy exhaustiveness without listing every case (06 — Pattern matching). As a type, the type that admits a value of any type (02 — Values and bindings).

arena — an allocator (ArenaAllocator, from @mem) that bumps a pointer through a chunk: allocation is an increment, free is a no-op, and reset() reclaims everything at once. The right default for build-use-discard work. (09 — Pointers and memory)

array pointer ([*]T) — a pointer plus a length, carried together in one value; a bounds-checked view of zero or more Ts in someone else's storage (elsewhere called a slice or fat pointer). String literals flow into [*]u8, and allocators hand out [*]Ts. (09 — Pointers and memory)

bare variant — naming an enum variant without its enum: None, Rect(2, 3). Legal wherever the expected type already names the enum — annotations, arguments, returns, switch arms — and it works for every enum: Some/None/Ok/Err are ordinary variants resolved this way, not keywords. (03 — Structs, enums, tuples)

barrel — a file that presents a package's public surface by re-exporting (export { … }) names it imported from per-concern files. The stdlib's @core is one. (14 — Modules and packages)

binder — the capturing slot inside a pattern: a name or _, optionally followed by : Type to check or narrow. Pattern bindings are always con. (06 — Pattern matching)

catch — the handle-it-here operator for a failure: expr catch fallback unwraps the success case or produces the fallback (a value, a block, or a handler function called with the error). Works on error unions and optionals alike. (07 — Optionals and errors)

defer — schedules a statement or block to run when the enclosing function exits — on every exit path (return, error propagation, panic), in last-in-first-out order. (08 — defer, recover, and panic)

directive — a file-scope if or for that runs during compilation and decides which declarations exist: if keeps one branch's declarations, for unrolls over a known iterable. Conditions must be known values. (11 — Known values and generics)

doc comment — contiguous /// lines forming a block that attaches to the top-level declaration immediately below; tooling (hover, the language server) surfaces the text. (reference/lexical)

dynamic identifier[expr] in any name slot (declaration name, field, variant, field access). The expression is evaluated at compile time, must reduce to a string, and that string becomes the name. (11 — Known values and generics)

entry — the file a program is rooted at. It must contain fn main() !u8; a package's manifest lists its entries under entries, one per executable. (14 — Modules and packages)

error channel — the failure half of a function's return type: the E of an E!T, or the None of a ?T. try propagates only within the same channel — crossing channels (absence becoming an error) is an explicit decision made with catch. (07 — Optionals and errors)

error unionE!T, read "an E or a T"; desugars to the plain enum Result(E, T), with the error carried by value. Bare !T leaves the error side to inference — the minimal union of what the body actually produces or propagates. (07 — Optionals and errors)

exhaustiveness — the rule that a switch must account for every value its subject can hold: every variant of an enum, every member of a union, and a required any arm for open subjects like integers and strings. (06 — Pattern matching)

fixed array ([N]T)N elements of T, with the length part of the type ([3]i32 and [4]i32 are different types). A plain value: assigning one copies all the elements. (09 — Pointers and memory)

interface — a behavioural shape: a set of method signatures. Satisfaction is structural — a type satisfies an interface when matching methods are in scope for it; there is no implements. (12 — Interfaces)

interface boxing — building an interface value at a cast site (con s: Speaker = &d): a fat pointer pairing the data pointer with a witness table of the methods resolved at that spot. You box a pointer, never a bare value. (12 — Interfaces)

known value — a value the compiler computes at compile time. The core vocabulary of the language: known parameters receive their arguments at compile time, the known operator forces an expression to be evaluated at compile time, and types themselves are known values — which is all a generic is. (11 — Known values and generics)

label#name prefixed to a loop or block; break #name (and, for loops, continue #name) then target it from anywhere inside. A labeled value-position block can yield early with break #name value. (05 — Control flow)

method set — the methods available on a type in a given scope. Methods are free-standing declarations, so the method set is a property of what's in scope — imports included — not of the type's definition. Anyone can extend any type. (14 — Modules and packages)

module — a .vyi file. Its top-level declarations are private unless marked export; import { … } from binds exported names directly into the importing file's scope — there is no namespace object. (14 — Modules and packages)

monomorphization — producing one concrete compiled copy of a generic function or type per distinct tuple of known arguments. Instantiation is memoized: every mention of Box(i32) is the same type. (11 — Known values and generics)

narrowing — the compiler shrinking what a value can be after a check: inside a switch typeof arm the subject narrows to the matched member; a : Type binder narrows to that type or variant; a check against a singleton value subtracts members for the rest of the function. (06 — Pattern matching)

optional?T, the type of a maybe-absent T; desugars to the plain enum Optional(T) with variants Some(T) and None. Vyi has no null — absence is always an optional, stated in the type. (07 — Optionals and errors)

package — a directory tree with a package.vyipac manifest at its root; the unit of naming, versioning, and dependency. Relative imports must stay inside the package root. (14 — Modules and packages)

panic — the report of an invariant violation: panic "reason" carries a human-readable [*]u8 and unwinds the stack, running each frame's defers. An unrecovered panic prints the reason and exits with status 101. Expected failure belongs in an error union instead. (08 — defer, recover, and panic)

pattern — a shape with binding slots, matched against a value. One grammar, four sites: switch arms, if Pattern = subject bindings, destructuring con declarations, and destructuring parameters. (06 — Pattern matching)

program — the import graph rooted at an entry file. The compiler starts at the entry, follows every import, and compiles what it reaches. (14 — Modules and packages)

receiver — the parenthesized binding written before a method's name: fn (p: Point) sum(). Four shapes: value (p: Point, a copy), writable pointer (p: *mut Point, may mutate), read-only pointer (p: *con Point, may read without copying), and type ((Point), called on the type itself). Calls adapt across one level of *mut/*con; exact shape wins when several methods apply. (04 — Functions and closures, methods & dispatch)

recover — the panic interceptor. Valid only inside a defer body; recover(reason) { … } runs only when the defer is running because of a panic, binds the reason string, and a return inside it halts the unwind. Panic-only: errors are values and never trigger it. (08 — defer, recover, and panic)

shape-compatible copy — the one large implicit conversion: a wider struct copies into a narrower struct whose fields (matched by name) it covers, dropping the extras, at every value-flow site. A copy, never aliasing — the source is untouched. (03 — Structs, enums, tuples)

singleton type — a known value used as a type: type Two = 2 is inhabited by exactly the value 2. Singletons compose into unions — "fast" | "slow" — and checks against them drive narrowing. (02 — Values and bindings)

stability (of known values and pointers) — a pointer is stable when its storage outlives every stack frame: allocator memory, globals, parameters you received, and reified known values — a known value you take the address of is baked into the program's data (a string literal's bytes are the everyday example). Only stable pointers may escape a function or be captured by a closure. (09 — Pointers and memory, 11 — Known values and generics)

try — the propagate operator: try expr unwraps the success case, and on failure returns the failure from the enclosing function — an Err through an error-union channel, a None through an optional one. (07 — Optionals and errors)

unit type (()) — the empty tuple: a real zero-size type and value. A function with no declared return type returns (); there is no void keyword. It composes — ()!T is a result whose error carries nothing. (02 — Values and bindings)

union typeA | B, a structural union: the value is one of the listed types, with the member types themselves as the cases. Construction is implicit, consumption is switch typeof, and narrower unions widen implicitly into wider ones. Inferred error sets are made of them. (03 — Structs, enums, tuples)

witness table — the method table frozen into an interface value when it is boxed: each interface method resolved exactly as a direct call written at the cast site would resolve. The table witnesses what was in scope where you boxed. (12 — Interfaces)