Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Keywords, Types, and Attributes

Keywords

KeywordUse
moduleName the file’s module
useImport names; embed fields; bring fields into scope
lib, asDeclare C functions (use lib "x" as y); as also casts
pubExport an item
fnFunction or method
struct, enumTypes
constModule constant
letLocal variable (always mutable)
if, elseBranch, or a value
while, for, inLoops
matchBranch on an enum
return, break, continueLeave a function or loop
deferRun at end of block
operatorDefine an operator method
thisMethod receiver

Types

Integersint (= i64), i8, i16, i32, i64, u8, u16, u32, u64
Floatsfloat (= f64), f32, f64
Otherbool, void, string, ptr, cstr
Arrays[N]T (fixed), []T (slice)
Pointers&T
Functionsfn(A, B): R

Attributes

AttributeMeaning
#[Debug]Printable in string interpolation
#[TryCatch(Ok, Err)]Enum works with ?
#[singleton]Process-wide value
#[thread]Per-thread (with #[singleton])
#[shader] #[vertex] #[varying] #[uniform] #[flat]Shader code and data (Shaders)

Intrinsics

@sizeof, @slice, @syscall, @atomicLoad, @atomicStore, @atomicAdd, @atomicSub, @atomicExchange, @atomicCas, @vmin, @vmax, @vsqrt, @vabs, @vsum, @vshuffle, @vfloat, @vint, @vload, @vstore, @script, @j3ui, @uiChoice, and the shader builtins and @shader (Shaders)

Operators

Arithmetic+ - * / %
Bits (integers)& | ^ ~ << >>
Compare== != < <= > >=
Logic&& || !
Assign= += -= *= /= %= &= |= ^=
Pointers&x (address), *p (deref)
Rangesa..b, a..=b, xs[a..b], xs[:]
Errorsexpr?

Not in J3

No interfaces or inheritance; traits are structural (a type has the methods, no impl blocks). Closures cannot escape (no heap environments): a closure(..) is a parameter or a let. No garbage collector or borrow checker. No null and no exceptions. No mutable globals besides #[singleton].