# Glossary

Key terms and concepts in the Vex ecosystem.

## A

**AOT (Ahead-of-Time)** -- Compilation mode that produces a standalone native binary before execution. Vex is AOT-only.

**Async Function** -- Function declared with `async fn` that can suspend at `await` points. Compiled to a state machine coroutine.

**Autograd** -- Automatic differentiation system for computing gradients of tensor operations, used in machine learning.

## B

**Borrowing** -- Creating a reference (`&T` or `&T!`) to a value without taking ownership. Governed by the borrow checker's NLL (Non-Lexical Lifetime) analysis.

**Box\<T\>** — A handle that owns a heap payload through Vex's memory model. Sharing, mutation, and taking the payload have distinct rules; see [Box](memory/box.md).

**Builtin** -- A compiler-provided operation or prelude item available without imports. `#Type.sizeOf<T>()` is compile-time, while `$println(value)` has runtime semantics.

## C

**Channel\<T\>** -- Multi-producer, multi-consumer bounded channel for communication between concurrent tasks. Use `ch <- val` to send and `<-ch` to receive.

**Closure** -- Anonymous function that can capture variables from its enclosing scope. Syntax: `|params|  expression`.

**Comptime** -- Compile-time code execution. Functions and expressions evaluated at build time rather than runtime.

**Contract** -- A trait-like interface defining shared behavior. Types implement contracts to gain capabilities. Syntax: `contract Name { method(); }`.

**Copy Type** — A type whose values may be duplicated under the language's copy rules rather than transferring an exclusive ownership obligation. Copying a view does not copy or extend the lifetime of its backing storage.

## D

**Defer** — A statement that schedules an action for scope exit. Use it to keep cleanup near resource acquisition; see [Error handling](error-handling.md).

**Drop** — The cleanup contract used when an owned value is destroyed. Moving a value transfers the cleanup obligation rather than duplicating it.

**DynMask** -- Compiler name for the runtime-sized source `Mask`. Its current packed host storage includes an owner; GPU transport is separate. See the [representation table](simd/simd-simt-contract.md#dynamic-mask-representation-in-the-development-implementation).

**DynTensor** — An implementation term for runtime-sized tensor storage. The source-level form is `Tensor<T>`; use the [tensor guide](simd/dynamic-tensors.md) for constructors, ownership, and indexing.

## E

**Enum** -- Sum type (tagged union) that can hold one of several variants. Each variant can carry payload data. Syntax: `enum Option<T> { Some(T), None }`.

**Expression-Oriented** -- Most language constructs (if, match, loop, blocks) are expressions that return values, not just statements.

## F

**FFI (Foreign Function Interface)** -- Mechanism for calling native functions from Vex and exporting Vex functions through a stable ABI. Imports use explicit `LIBC`, `SYSTEM`, `NATIVE`, or private `VEX` providers; outbound C ABI definitions use `export "C" fn`.

**Freestanding** -- Build policy with no implicit libc/CRT dependency. It is selected with `--no-runtime` or `native.useSystemLibC: false`, not a `#![no_std]` attribute.

**Fusion (SIR Fusion)** — Combining compatible operations into a shared execution plan or kernel to reduce intermediate work. Whether fusion occurs depends on dependencies and backend support.

## G

**go Block** — A block scheduled as concurrent work, for example `go { ... }`. Design completion, cancellation, and captured-value lifetimes explicitly; see [Concurrency](concurrency/overview.md).

**graph fn** — A function whose supported operations are represented through the graph/SIR pipeline. Execution backend and dispatch are governed by the [graph-function model](gpu/graph-functions.md), not by the keyword alone.

## H

**HIR (High-Level IR)** -- The intermediate representation after parsing and type checking, before lowering to SIR or LLVM IR.

**Horizontal Reduction** -- Collapsing a tensor/array to a scalar using an associative operation. Syntax: `<+ arr` (sum), `<* arr` (product), `<?| arr` (min), `>?| arr` (max).

## I

**Iterator** -- Contract for types that yield a sequence of values. Powers `for` loops. Method: `next(): Option<Self.Item>`.

## L

**LLVM** — The backend infrastructure used for native code generation. Its required version belongs to the selected compiler build; see [Installation](installation.md).

**Lifetime** -- The span of execution during which a reference is valid. Vex uses NLL (Non-Lexical Lifetime) analysis to verify borrow safety.

**LTO (Link-Time Optimization)** — Optimization that retains intermediate representation across the link boundary. Full LTO and ThinLTO have different compilation costs; measure the selected toolchain rather than assuming one always produces faster code.

## M

**M:N Scheduler** -- User-space scheduler that multiplexes M coroutines onto N OS threads. Uses work-stealing for load balancing.

**Mask\<N\>** -- Compile-time-sized SIMD boolean vector resulting from tensor comparisons. Supports bitwise operations and reduction queries.

**Move Semantics** -- For non-Copy types, assignment transfers ownership. The source becomes inaccessible after a move.

## N

**never** -- The bottom type with no possible values. Return type of diverging expressions such as `$panic` and infinite `loop`. Coerces to any type.

**NLL (Non-Lexical Lifetimes)** -- The borrow checker algorithm that computes liveness based on actual usage rather than lexical scope boundaries.

## O

**Operator Overloading** -- Defining custom behavior for operators (`+`, `==`, `[]`, etc.) by implementing the corresponding contract (`Add`, `Eq`, `Index`).

**Option\<T\>** -- Type representing a value that may be absent. Variants: `Some(T)` or `None`. Safe alternative to null pointers.

**OrderedMap\<K, V\>** -- Hash map that preserves insertion order. Combines O(1) lookup with predictable iteration.

**Ownership** — The rules determining who is responsible for a value's lifetime and cleanup, when that responsibility moves, and what access a borrow permits. Shared handles and non-owning views must obey their own contracts.

## P

**Pin** — A prelude marker contract that restricts moves which could invalidate self-references. It is not a `Pin<T>` wrapper. Pinning does not by itself establish a valid lifetime or exclusive access; see [Pin](memory/pin.md).

**Prelude** -- Set of types and functions always available without explicit import. Includes `Option`, `Result`, `Vec`, `Box`, `Ptr`, `Span`, `string`, etc.

**Ptr\<T\>** — A typed pointer to storage. The element type alone does not establish validity, initialization, alignment, lifetime, or exclusivity; see [Typed pointers](memory/ptr-t.md).

**Opaque pointer** — A pointer used without an exposed payload type, commonly `Ptr<Opaque>` at an interoperability boundary. Historical raw-pointer spellings are described in [Raw pointers](types/raw-pointers.md).

## R

**Range** — A sequence or selection described by bounds. `0..10` excludes the upper bound and `0..=10` includes it. Omitted endpoints are context-dependent; see [Ranges](types/range.md).

**RawBuf** — A byte-addressed view used for explicit typed loads and stores. It does not own storage or prove that a byte range is valid; see [RawBuf](memory/rawbuf.md).

**Result\<T, E\>** -- Type representing either success (`Ok(T)`) or failure (`Err(E)`). Primary error handling mechanism with `?` operator for propagation and `!>` rescue operator for fallback values.

**Rescue Operator (`!>`)** -- Infix operator that extracts a value from `Option<T>` or `Result<T,E>`, providing a fallback on `None`/`Err`. Syntax: `val !> fallback` or `val !> || { computeFallback() }`. The development prelude does not declare an `.unwrap()` method.

## S

**SIMD (Single Instruction, Multiple Data)** — Machine operations that process several data lanes together. Vex exposes data-parallel intent through array/tensor operations; actual instruction selection depends on the target and optimization path.

**SIR (Silicon IR)** — Vex's representation for data-parallel operations and their transformations. Backend support and operation coverage are described in [SIR and backends](../architecture/sir-and-backends.md).

**Span\<T\>** — A non-owning view of contiguous elements. Bounds-checked access does not prove that the backing storage is alive or was constructed correctly; see [Span](memory/span-t.md).

**str (VexStr)** — A borrowed string view. Its lifetime is tied to the storage it views; copying the view does not make an owned string.

**string (VexString)** — An owned string abstraction. Encoding, indexing, and conversion behavior are described in [Strings](types/strings.md); do not infer a portable ABI from a particular host layout.

**Struct** -- Composite data type with named fields. Can implement contracts, have methods, and define constructors.

## T

**Tensor\<T, N\>** — A statically sized tensor form; `Tensor<T>` has a runtime size. Shape and elementwise intent are separate from physical register placement; see [SIMD and tensors](simd/index.md).

**Threadgroup Memory** — Storage shared by invocations in a GPU workgroup. Its capacity, synchronization rules, and use depend on the backend and kernel model.

## U

**Unit Type (`()`)** -- Zero-size type with exactly one value: `()`. Default return type for functions without a meaningful return value. Not the same as C's `void`.

**unsafe** — A boundary where the programmer must establish the preconditions of operations that the compiler cannot prove. It does not disable all checking or make invalid memory access correct.

## V

**Vec\<T\>** — A growable, owning sequence of elements. Growth and mutation can affect borrowed views; see [Vec](types/vec.md).

**VUMM** — The compiler/runtime memory model connecting ownership, sharing, and storage management. Representation choices do not remove application obligations around aliasing, mutation, synchronization, or borrowed lifetimes; see [VUMM](memory/vumm.md).

## W

**Work-Stealing** -- Scheduling algorithm where idle worker threads "steal" tasks from busy workers' queues. Provides automatic load balancing for the M:N scheduler.
