Docs · Appendix
Glossary
The terms these docs use, in alphabetical order. Each entry links to the page that explains it in full.
_ (underscore): the inference placeholder. Where a type belongs, as in
fn double(n: i32) _, the compiler works the type out; in a pattern, _
matches anything and binds nothing.
(guide 04,
types reference)
allocator: a value that hands out memory, through the Allocator
interface from @mem. Nothing in Vyi allocates unless you pass it an
allocator. (guide 09)
arena: an allocator, ArenaAllocator from @mem, that hands out memory
from large chunks and gives it all back at once with reset() or deinit().
(guide 09)
array pointer: [*con]T or [*mut]T, a pointer to a run of T values
together with their count. Indexing through it is bounds-checked, and a string
literal is a [*con]u8.
(guide 09)
binder: a name in a pattern that receives part of the value, such as r
in Circle(r). A binder can carry a type to narrow to, as in e: NetError,
and is always a con.
(guide 06)
build mode: debug (the default) or release, chosen with --mode. In
debug, integer overflow panics; in release, it wraps.
(targets)
C twin: a C type and the Vyi type with the same size and signedness, such
as c.int and i32. A value converts between twins where the target type is
written, and a struct converts to a c_struct whose fields are its twins.
(guide 15)
catch: handles a failed optional or result where it happens:
expr catch fallback gives the success value, or the fallback on failure.
(guide 07)
default: the arm of a switch or match that runs when no other arm
matches. (guide 05)
defer: runs a statement or block when the function exits, by any path.
Several defers run in reverse order.
(guide 08)
doc comment: a run of /// lines directly above a declaration, shown by
the editor on hover and in completion.
(lexical reference)
dynamic identifier: [expr] in a place where a name goes. The
expression is a known value that gives a string, and that string becomes the
name. (guide 11)
entry: the file a program starts from, which declares fn main() !u8. A
manifest names its package's entries under entries.
(manifest)
error declaration: declares named errors with a message each, as in
error DiskFull "disk is full". On its own, error is the open error type,
which holds a member of any error declaration.
(guide 07)
error set: the error side of a result type, the E in E!T. With !T,
the compiler infers it as the union of every error the function's body can
produce. (guide 07)
exhaustiveness: the rule that a switch or match has an arm for every
value or variant its subject can be, or a default arm.
(guide 05,
guide 06)
file-level variable: a con or mut binding declared outside any
function. The file that declares it owns it: other files may read it when it's
exported, and only the owning file writes to it.
(guide 02,
guide 14)
fixed array: [N]T, N values of type T whose count is part of the
type. Assigning one copies every element.
(guide 09)
interface: a list of method signatures. A type satisfies it when those
methods are found for the type; there is no implements.
(guide 12)
interface value: a value of an interface type, made by converting a
pointer, as in con s: Speaker = &dog. It points at the value and keeps the
methods found where it was converted.
(guide 12)
known value: a value the compiler works out while compiling: a literal, a
type, a known parameter's argument, or the result of known expr. Compare
runtime value.
(guide 11)
label: #name before a loop or block, which break #name and
continue #name refer to.
(guide 05)
lifetime annotation: '(p) after a return type or a parameter, saying
the pointer is valid as long as what p points at. The compiler checks it
against the body and against every call.
(guide 09)
manifest: package.vyipac, the YAML file at a package's root that names
the package, its entries, and its dependencies.
(manifest)
match: picks an arm by an enum's variant, or by the type a union holds,
and binds the variant's payload.
(guide 05)
method: a function with a receiver, called as value.method(). It is
declared outside the type, and any file can declare one for any type.
(guide 04)
method item: an import item that names a method by its receiver type, as
in import { Rect.perimeter } from "./measure". A method is never imported by
its bare name.
(guide 14)
module: a .vyi file, when talking about imports. Its declarations stay
in the file unless marked export.
(guide 14)
narrowing: after a check, the compiler treats a value as the narrower type
the check proved, as inside a match typeof arm.
(guide 06)
optional: ?T, a value that may be missing. It is the enum
Optional(T), with the variants Some(T) and None; Vyi has no null.
(guide 07)
package: a folder with a package.vyipac manifest at its root, and every
.vyi file under it. The standard packages have names that start with @.
(guide 14)
panic: stops the program for a failure no caller can handle. It unwinds
the stack, running each function's defers, and unless a recover stops it,
the program exits with status 101.
(guide 08)
pattern: a shape that a value is matched against, with binders for its
parts. Patterns appear in match arms, if bindings, and destructuring
declarations. (guide 06)
payload: the data an enum variant carries, such as the i32 in
Square(i32). A match arm binds it: Square(n).
(guide 03)
pocket: the methods that travel with a type through imports. A method exported beside the type, or beside its import in a file that re-exports it, goes into the pocket. A call looks in scope first and in the pocket second. (guide 14)
program: an entry file and every file its imports reach. (guide 14)
receiver: the part in parentheses before a method's name, saying what the
method works on: a value (a: Account), a pointer (a: *mut Account) or
(a: *con Account), or the type itself (Account).
(guide 04)
recover: catches a panic. It is written inside a defer body, and a
return in its block stops the unwind.
(guide 08)
result: E!T, a value that is either a success T or an error E. It is
the enum Result(E, T), with the variants Ok(T) and Err(E).
(guide 07)
runtime value: a value known only while the program runs, such as a
function's parameter or a mut binding. Compare known value.
(guide 11)
scope: the region of code where a name can be used: a block and the blocks inside it, with the file as the outermost. A method call looks in scope before it looks in the pocket. (statements reference)
singleton type: a type with exactly one value, made from a known value, as
in type Two = 2. A union of singletons, such as "fast" | "slow", lists
the values a binding may hold.
(guide 02)
slot: the lifetime of one pointer field of a struct. A struct with several
pointer fields has a slot for each, and an annotation such as 'src(text)
names one. (guide 09)
string template: $"...", a string with values inserted, as in
$"total: ${n}".
(guide 10)
switch: picks an arm by comparing its subject with each arm's value
using ==. (guide 05)
target: the kind of machine a program is compiled for: wasm (the
default), x86-64-linux, or arm64-linux, chosen with --target.
(targets)
try: unwraps a success, and on failure returns the failure from the
current function. (guide 07)
type variable: a name in a function's signature that names no declared
type, as T in fn larger(a: T, b: T) T. Each call works it out from the
arguments.
(guide 11)
union type: A | B, a value that holds one of the listed types. `match
typeof` tells which one it holds.
(guide 03)
unit type: (), the empty tuple: a type with exactly one value, also written (). A function
with no return type returns it.
(guide 02)
variant: one of an enum's named cases, which may carry a payload. Where
the expected type is the enum, a variant is written without the enum's name,
as None or Square(4); Some, None, Ok, and Err are ordinary
variants. (guide 03)