Types

pub type boolean size(1)

Primitive types built into loft. True or false value.

pub type integer size(8)

64-bit signed integer.

pub type single size(4)

32-bit floating-point. Good for graphics and performance-sensitive math.

pub type float size(8)

64-bit floating-point. Use when precision matters.

pub type text size(4)

UTF-8 string.

pub type character size(4)

A single Unicode code point.

pub type u8 = integer limit(0, 255) size(1)

Integer subtypes for compact storage in struct fields. Behave as integer in expressions. 0 – 255, 1 byte.

pub type i8 = integer limit(-128, 127) size(1)

-128 – 127, 1 byte.

pub type u16 = integer limit(0, 65535) size(2)

0 – 65535, 2 bytes.

pub type i16 = integer limit(-32768, 32767) size(2)

-32768 – 32767, 2 bytes.

pub type i32 = integer size(4)

4-byte signed: -2_147_483_647 – 2_147_483_647. The bottom of the 32-bit range (-2147483648) is the null sentinel, so it is not a value an i32 can hold — C127's pragmatic exemption: an i32 overflow reads null, where every other narrow type's reads its default. Pinned by the language suite's 1615-every-narrow-slot-answers-the-types-default-for-an-unfitting-value.

pub type u32 = integer limit(0, 4294967295) size(4)

4-byte unsigned: 0 – 4_294_967_295, the whole width. It has no null: an overflow reads 0, the type's default (C127). u32? keeps the top code for its null, as u8? does, and holds 0 – 4_294_967_294. size(4) forces 4-byte storage and serialisation symmetric with i32. u32 is for file / wire-format fields (magic numbers, counts, tick fields) where the byte width is the load-bearing property.

pub type i64 = integer size(8)

8-byte signed: the full integer, spelled so that it stays 64-bit in a file under the 32-bit regime (#width 32), where a plain integer is an i32. Elsewhere it is integer by another name.

pub type f64 = float

The 64-bit float, spelled so that it stays a double in a file under the 32-bit regime (#width 32), where a plain float is a single. Elsewhere it is float.

pub enum Ordering {
  Less,
  Equal,
  Greater
}

Where one value stands against another: what compare answers. An enum rather than a signed number, so a comparison cannot be written as a subtraction that overflows.