Type System

Ea is statically typed with no implicit conversions. Every variable, parameter, and expression has a concrete type known at compile time.

Scalar Types

TypeSizeDescription
i81 byteSigned 8-bit integer
u81 byteUnsigned 8-bit integer
i162 bytesSigned 16-bit integer
u162 bytesUnsigned 16-bit integer
i324 bytesSigned 32-bit integer
u324 bytesUnsigned 32-bit integer
i648 bytesSigned 64-bit integer
u648 bytesUnsigned 64-bit integer
f324 bytes32-bit float (IEEE 754)
f648 bytes64-bit float (IEEE 754)
bool1 byteBoolean (true or false)

Integer literals default to i32. Float literals default to f32. Use explicit casts (to_f64(x), to_i64(x)) to convert between types.

Vector Types

Vector types hold multiple lanes of the same scalar type. Element-wise operations use dot-operators (.+, .-, .*, ./, etc.).

128-bit Vectors -- SSE (x86) / NEON (ARM)

TypeLanesElementSize
f32x44f3216 bytes
f64x22f6416 bytes
i32x44i3216 bytes
i16x88i1616 bytes
i8x1616i816 bytes
u8x1616u816 bytes
u16x88u1616 bytes

256-bit Vectors -- AVX2 (x86 only)

TypeLanesElementSize
f32x88f3232 bytes
f64x44f6432 bytes
i32x88i3232 bytes
i16x1616i1632 bytes
i8x3232i832 bytes
u8x3232u832 bytes
u16x1616u1632 bytes

These types produce a compile error on ARM targets.

512-bit Vectors -- AVX-512 (x86, --avx512 flag required)

TypeLanesElementSize
f32x1616f3264 bytes
f64x88f6464 bytes
i32x1616i3264 bytes

Using these types without --avx512 produces a compile error.

Pointer Types

Pointers represent caller-provided memory. Ea never allocates -- all memory comes from the host language.

SyntaxDescription
*TImmutable pointer to T
*mut TMutable pointer to T
*restrict TImmutable pointer, no-alias guarantee
*restrict mut TMutable pointer, no-alias guarantee

The restrict qualifier tells the compiler that the pointer does not alias other pointers, enabling stronger optimizations. Use it when you can guarantee non-overlapping memory.

Struct Types

User-defined value types declared with struct:

struct Pixel {
    r: f32,
    g: f32,
    b: f32,
    a: f32,
}

Structs are passed by value. Access fields with dot syntax: pixel.r. Structs can contain scalar types, vector types, and other structs.

Type Rules

  • No implicit conversions between types. Use to_f32(), to_i32(), etc.
  • No generics or polymorphism. Write separate functions for each type.
  • Vector dot-operators require both operands to have the same vector type.
  • Comparisons on vectors (.==, .<, .>) produce boolean vectors, not scalar bools.