Built-in Aliases
Some built-in type names are themselves compiler-provided aliases — convenient default spellings for a specific underlying type. Like any alias they are transparent, so the alias and its target are the same type.
type float = float64; // compiler intrinsic alias
Default-Width Aliases
These three names alias the most common width of their family, so unsuffixed code reads naturally:
| Alias | Target | Notes |
|---|---|---|
float | float64 | Type of an unsuffixed float literal |
bool | bool8 | The everyday boolean |
char | char32 | A full Unicode scalar value |
Target-Dependent Aliases
These names alias a type whose width follows the platform's pointer size — *32 on a 32-bit target and *64 on a 64-bit target. Use them for sizes, indices, and counts that should match the machine's natural word:
Semantic Aliases
This name aliases a type of the same width but reads more clearly at the call site. byte is the same 8-bit unsigned integer as uint8; prefer it wherever a value is raw memory rather than a small number — buffers, binary protocol fields, and serialisation:
let header: byte = 0xFF; // reads as "one raw byte"
let count: uint8 = 12; // reads as "a small number"
Because the two are the same type, a byte and a uint8 are interchangeable — you can assign one to the other and pass either to a function expecting the other, with no cast.
See Also
- Type Aliases — how aliasing works in general
- Primitive Data Types — the full table of built-in types and their sizes
Function Type Aliases
A function type describes a callable signature — its parameter types and its return type — without naming a particular function. It is written with the func keyword followed by the parameters and an optional -> return type:
Overview
An interface declares a set of method signatures that a type must satisfy, enabling shared behavior across unrelated types. Each aspect has a dedicated chapter: