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.

u32 reserves a code too, at the top of its range, and the two reservations LOOK alike and do not behave alike: an i32 overflow reads null, a u32 overflow reads 0, the type's default. That is not a claim that the reservations differ — it is C127's pragmatic exemption, allowed because losing one value out of 2^32 is cheap and being the one narrow type whose overflow is detectable is worth more (DESIGN_DECISIONS.md C127 § Decision). Pinned across both aliases by tests/scripts/1615-every-narrow-slot-answers-the-types-default-for-an-unfitting-value.

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

4-byte unsigned: 0 – 4_294_967_294. The top code is reserved to buy the same refusal i32 gets at the bottom (u32 = 4294967295 does not compile) — and, unlike i32, it is NOT a null: an overflow here reads 0, the type's default (C127, and the note on i32 above says why the two differ). size(4) forces 4-byte storage and serialisation symmetric with i32, and a value in the upper half (2^31..2^32-2) reads back as the same positive integer. u32 is for file / wire-format fields (magic numbers, counts, tick fields) where the byte width is the load-bearing property; plain integer holds the whole 0..2^32-1 range and more.

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.