Envzn primitives

Every primitive type in the language, grouped by what it is for, with the aliases the compiler accepts. The normative rules live in ENVZN_CONSTITUTION.md (Part I.D); conversions between them are in docs/CONVERSIONS.md. This page is the quick reference.

Generated by bin/build_primitives_doc.py from the compiler's primitive table (compiler/primitives.py). Do not edit by hand: change the generator and re-run it. The build fails if the compiler gains a primitive this page does not describe.

Signed integers

Primitive Description
int8 (i8) Signed 8-bit integer. Overflow is a MathError PANIC, never a silent wrap. Range −128 to 127.
int16 (i16) Signed 16-bit integer. Overflow PANICs. Range −32,768 to 32,767.
int32 (i32) Signed 32-bit integer. Overflow PANICs; name it explicitly when you want 32 bits. Range −2^31 to 2^31−1.
int64 (integer, int, i64) The default integer: int and integer mean int64, as does a FOR counter and an array's .length. Overflow PANICs. Range −2^63 to 2^63−1.
int128 (i128) Signed 128-bit integer, a full V1 primitive with arithmetic, comparison and the keyword-bitwise operators. Range −2^127 to 2^127−1.

Unsigned integers

Primitive Description
uint8 (u8) Unsigned 8-bit integer. Overflow, including going below zero, PANICs exactly as a signed type does. Range 0 to 255.
uint16 (u16) Unsigned 16-bit integer. Overflow PANICs. Range 0 to 65,535.
uint32 (u32) Unsigned 32-bit integer. Overflow PANICs. Range 0 to 2^32−1.
uint64 (uint, u64) Unsigned 64-bit integer. Overflow PANICs. Range 0 to 2^64−1.
uint128 (u128) Unsigned 128-bit integer, a full V1 primitive. Range 0 to 2^128−1.

Floating point

Primitive Description
float32 (float, f32) IEEE 754 single precision. Untrapped: overflow gives ±Infinity and underflow a signed zero, the type's defined results. 32 bits.
float64 (f64) IEEE 754 double precision, the usual choice for real numbers. Untrapped, like float32; == is exact IEEE equality. 64 bits.

Exact and flexible numbers

Primitive Description
number A self-aware int64 or float64 that promotes up INTEGER → UNSIGNED → FLOAT instead of overflowing. Opt-in, and Equatable only.
complex A pair of numbers written with im (3 + 4im), with .real, .imaginary, .magnitude and .phase. Equatable only; it has no ordering.
decimal128 (decimal) IEEE 754-2008 exact base-10 with 34 significant digits, rounding half-even. Comparable and Hashable, so it can key a Dictionary.

Truth, characters and bytes

Primitive Description
boolean TRUE or FALSE. Never converts implicitly to or from a number.
char8 (c8) One 8-bit UTF-8 code unit, which is not a code point (a lead byte is not a character). Stored like uint8 but a distinct type. 8 bits.
char16 (c16) One 16-bit UTF-16 code unit. Stored like uint16 but a distinct type. 16 bits.
char32 (char, character, c32) One Unicode code point, U+0000 to U+10FFFF: char and character mean char32. A code point plus an integer is still a code point. 32 bits.
binary An opaque 8-bit octet: a bit pattern, not a number. It takes assignment, the offset operators, the keyword-bitwise operators and comparison, and defaults to 0x00. 8 bits.

Type erasure

Primitive Description
opaque A value carried behind a runtime type tag, for heterogeneous storage the static types cannot express, such as a dictionary whose values differ in type per key.

C-ABI boundary types (FOREIGN BIND only)

Primitive Description
C.size_t C's size_t, spelled exactly, for FOREIGN BIND declarations only. No guaranteed width and no arithmetic; that is its contract.
C.ssize_t C's ssize_t, for FOREIGN BIND declarations only.
C.long C's long, for FOREIGN BIND declarations only; its width differs by platform, which is why it is named rather than guessed.
C.unsignedLong C's unsigned long, for FOREIGN BIND declarations only.

Reserved names (not usable)

Primitive Description
complex_int32 Retired in favour of complex. Kept reserved so the name is rejected (E2009), not reused.
complex_float32 Retired in favour of complex; reserved so the name is rejected.
complex_float64 Retired in favour of complex; reserved so the name is rejected.
bigint Reserved for an arbitrary-precision integer. Not usable yet.
rational Reserved for an exact fraction. Not usable yet.
bit Reserved for a single bit. Not usable yet.

Not primitives

Name What it is
String An immutable Unicode text class (char32), always present: an empty string is "", never EMPTY.
ByteBuffer An immutable byte class, the binary twin of String.
DynamicString The mutable text class; DynamicByteBuffer is its binary twin.
STATUS The SUCCESS / FAILURE result type, a built-in enum rather than a primitive.
VOID Return-shape syntax (RETURNS VOID), not a type you can declare.