Type Reference
Built-in types
Type |
C representation |
Description |
|---|---|---|
|
|
Integer arithmetic; default numeric type |
|
|
Floating-point arithmetic |
|
|
Logical values; truthiness |
|
Heap-allocated |
Length-prefixed; supports concatenation and indexing |
|
|
Dynamic array; |
|
|
Associative map (string keys only) |
|
Tagged map instances |
User-defined record types (C-layout records are tracked work, S-0; today field storage is map-based — see Memory Model) |
|
Tagged variant (payload recorded, matched on tag) |
Algebraic data type; patterns are |
|
Tagged wrappers ( |
Presence and fallible results; |
|
Raw C pointer / borrow / mutable borrow |
Unsafe and ownership-checked access (borrow checker, escape analysis) |
|
GMP-backed arbitrary precision |
Linked with |
|
Continuous row-major 2D array (AVX2-optimized) |
|
Type inference
let and var declarations infer the type from the right-hand side:
let x = 42 // int
let pi = 3.14 // float64
let msg = "hello" // string
let flag = true // bool
let arr = [1, 2, 3] // array
Typed declarations
Explicit type annotations follow a colon:
let y: float64 = 3.14
var count: int = 0
The annotation must be compatible with the initializer. A mismatch produces
a diagnostic (K112 — primitive annotation/initializer mismatch).
Conversion functions
float() converts a value to float64. Supported inputs:
Input type |
Behavior |
|---|---|
|
Integer-to-float promotion |
|
Identity (no-op) |
|
Parse string as float |
|
|
let x: float64 = float(42) // 42.0
let y: float64 = float("3.14") // 3.14
let z: float64 = float(true) // 1.0