Evaluates RHS once and binds positional .0, .1, … fields (_ skips a slot; primed a' creates mutable local bindings)
Named field destructuring
(x, y) = pt (x = px, y = py) = pt
Local or module destructuring
Extracts listed named record fields by name (field = local renames the local binder; unmentioned fields are ignored)
Mutable module global
::g = expr
Module-wide mutable state
Readable as g or ::g; writable inside functions as g = v, ::g = v, or g ::= v (E3033 if g was not declared with ::)
Forward type annotation
x: Type (own line)
Local or module declaration
Declares the static type of x before assignment; allocates no zeroed storage (E3045 if read before write; E3130 on partial record init)
Inline type + value
x: Type = expr
Forbidden
Rejected with E2009; place x: Type on the line preceding x = expr
Discard assignment
_ = expr
Forbidden
Rejected with E2044; invoke side-effecting calls directly as statements
#useio::counter =0bump: Int=>Intbump = delta => counter = counter + deltaacc'= counteracc'=acc'*2acc'(lo, hi) = (10, 20)(x = px, y = py) = (x =5, y =9, z =12)io::out $ (bump(5), lo + hi + px + py) // (10, 44)
4.2 Function signatures and definitions
Function types and parameter names are separated onto consecutive declarations:
Form
Syntax
Semantics
Diagnostic
Multi-parameter signature
f: T1, T2 => R
Declares positional parameter types and return type R
E3084: body type mismatch
Nullary signature
f: () => R
Declares a 0-argument function returning R
—
Void return signature
f: T1 => ()
Declares a side-effecting function returning Unit (void)
E2104: () used as value expr
Compile-time parameter
f: #param T: Type, T => R f: #param N: Int => R
Declares compile-time Type or constant parameter specialized per call site
E3129: Type lowered at runtime
Function definition
f = a, b => body f = (x, y) => x + y
Bare parameter names, or parenthesized tuple/record destructuring parameters ((a, b) =>, (x = px, y = py) =>); single-identifier (x) => is forbidden (E2037)
E2040: explicit _ parameter
Nullary definition
f = !=> body
0-argument function body; invoked exclusively with postfix ! (f!); f() is rejected (E2086)
E2086: () on function call
Unannotated function
f = a, b => a + b
Inferred via static unification across body and call sites; never defaults unknown types to Int
#type registers a nominal or structural type in the current module scope:
Type Category
Syntax
Representation & Semantics
Scalar / type alias
#type UserId Int #type Point2 Vec2
Transparent alias for an existing primitive, composite, or nominal #type (shares the target’s nominal identity)
Named record
#type Point (x: Int, y: Int = 0)
Nominally distinct C-ABI aligned product type (E3084 on name mismatch against other #type records); unifies with matching anonymous records (x = 1, y = 2) and tuples (1, 2)
Multiline record
#type Point x: Int y: Int
Indented or parenthesized multiline field list; newline separates aligned fields
Positional tuple
#type Pair (Int, String)
Positional fields accessed via .0, .1, …
Homogeneous tuple / SIMD
#type Vec4 (Float * 4)
Contiguous inline repetition of N elements; supports SIMD arithmetic and intrinsics
Packed / aligned record
#type(packed, align = 4) Hdr (...)
packed removes padding; align = N enforces power-of-two byte alignment N
Arena-backed open-addressed hash table (Key in String, Int, Addr)
Ramification
#type Opt < Int | > #type Res < Int | Error >
Two-slot positional sum type (RamPN, RamNP, or RamPP)
Nominal enum
#type Expr < Lit(Int), Add(Expr, Expr), Nop >
16-byte { i64 tag, ptr payload } tagged union with \(\ge 2\) uppercase variants (E2070, E2012, E2074)
Type generator (#param)
Box: #param T: Type => (val: T) #type IntBox Box(Int)
Compile-time function returning a Type, instantiated via #type
4.4 Modules, visibility, and FFI directives
Directive
Syntax
Scope & Semantics
Diagnostic
Standard library import
#use io #use net/http
Resolves strictly in std/<name>.dva (no ./, ../, or @ prefix; quotes " are forbidden, E1015). Binds module under its last path segment (io::out, http::get)
E5006: module not found E1015: quotes in #use
Local module import
#use ./lexer #use ./index.vid #use ../src/ui
Resolves strictly relative to the importing file’s directory (./ or ../ required; spaces escaped as \). Binds base stem of last segment (index.vid.dva\(\to\)index::)
E5006: local module not found
Package import
#use @pkg #use @pkg/sub
Resolves external dependency declared in edva.ccl via .edva/imports.ccl
E5030–E5038, E7001–E7021: package errors
Public visibility
#public / #pub #public f: Int => Int
Alone on a line: sets default visibility to public for subsequent declarations. Prefixing a declaration: exports that single symbol/type
E3005: private symbol access
Private visibility
#private / #priv #private helper = ...
Alone on a line: resets default visibility to module-private. Prefixing a declaration: marks that single symbol private