Skip to content

Type System

TypeSizeDescription
i648 bytes64-bit signed integer
f648 bytes64-bit IEEE 754 float
bool1 byteBoolean (i8 in Cranelift)
void0 bytesNo value (unit type)
TypeDescription
stringUTF-8 string (runtime-managed)
array<T>Dynamic array of type T
struct<Name>Named struct with typed fields
TypeDescription
&TImmutable reference
&mut TMutable reference (exclusive)
TypeDescription
result<T, E>Success (Ok(T)) or failure (Err(E))
option<T>Value (Some(T)) or nothing (None)

Types are specified via duumbi:valueType and duumbi:returnType:

{
"@type": "duumbi:Const",
"duumbi:value": 42,
"duumbi:valueType": "i64"
}
{
"@type": "duumbi:Function",
"duumbi:returnType": "result<i64, string>",
"duumbi:params": [
{ "duumbi:name": "x", "duumbi:paramType": "&array<i64>" }
]
}
  • Arithmetic ops (Add, Sub, Mul, Div) require matching operand types
  • Compare works on matching numeric types, returning bool
  • Branch requires a bool condition
  • Call validates parameter types against function signature
  • Match requires a result<T,E> or option<T> discriminant