Djinn Lang
Std

Built-in Types

Boolean

Type

Alias

Size

Integers

i(n) and u(n) are valid for any bit width n. You can create integers of arbitrary size, e.g. i7, u3, i256.

Signed

Type

Size

Range

i81 byte-128 to 127
i162 bytes-32K to 32K
i324 bytes-2B to 2B
i648 bytes-9.2E to 9.2E
i12816 bytes-170U to 170U

Unsigned

Type

Size

Range

u81 byte0 to 255
u162 bytes0 to 65K
u324 bytes0 to 4B
u648 bytes0 to 18E
u12816 bytes0 to 340U

Floating Point

Type

Size

Precision

f324 bytesSingle precision (IEEE 754)
f648 bytesDouble precision (IEEE 754)

Primitive Constants

All numeric types expose MAX_VALUE and MIN_VALUE constants. Floating-point types also expose MIN_POSITIVE and EPSILON:

i32 max = i32.MAX_VALUE;   // 0x7FFFFFFF
i32 min = i32.MIN_VALUE;   // 0x80000000
u64 umax = u64.MAX_VALUE;  // 0xFFFFFFFFFFFFFFFF

f64 eps = f64.EPSILON;          // 2.2204460492503131e-16
f32 minPos = f32.MIN_POSITIVE;  // 1.17549435e-38

Type

MAX_VALUE

MIN_VALUE

i8127-128
i1632767-32768
i320x7FFFFFFF0x80000000
i640x7FFFFFFFFFFFFFFF0x8000000000000000
u82550
u16655350
u320xFFFFFFFF0
u640xFFFFFFFFFFFFFFFF0

Type

MAX_VALUE

MIN_VALUE

MIN_POSITIVE

EPSILON

f323.40282347e+38-3.40282347e+381.17549435e-381.19209290e-7
f641.7976931348623157e+308-1.7976931348623157e+3082.2250738585072014e-3082.2204460492503131e-16

Size Types

Type

Alias

Description

sizeu32Platform size type
size_longu6464-bit size type
c_resulti32C interop result type

Void

Type

Description

Strings

Type

Description

Arrays

Type

Description

Pointers

Type

Description

Reflection

TypeInfo

struct TypeInfo {
    i32 id;
    i32 size;
    i8* name;
    u8 kind;
}

Runtime type metadata available via the typeof intrinsic. The kind field encodes the category: 0 = integer, 1 = float, 2 = pointer.

object

struct object : Hashable {
    TypeInfo* type;
    void* data;
}

A type-erased value with runtime type information. Used internally by variadic functions to inspect argument types at runtime.

Enums

optional<T>

Variant

Description

Empty()No value present
Value(T)Contains a value of type T
enum optional<T> {
    Empty(),
    Value(T)
}

result<T, E>

Variant

Description

Ok(T)Success, contains the result value
Error(E)Failure, contains the error value
enum result<T, E> {
    Ok(T),
    Error(E)
}

On this page