Types
Arden is strongly and statically typed: every expression has a known compile-time type.
Why This Matters
Type checks move failures from runtime into arden check/arden build.
That gives faster feedback loops and safer refactors.
Primitive Types
| Type | Description | Example |
|---|---|---|
Integer |
64-bit signed integer | 42, -1 |
Float |
64-bit floating point | 3.14, -0.01 |
Boolean |
Boolean value | true, false |
Char |
Unicode scalar | 'a', '🚀' |
String |
UTF-8 string | "Hello" |
None |
Unit type | None |
Numeric Rules
function main(): None {
a: Integer = 1;
b: Float = 2.5;
c: Float = a + b; // Integer promotes to Float inside numeric expression
return None;
}
Important constraints:
- mixed numeric expressions can widen
IntegertoFloat - assignments still require type-compatible RHS
- container/generic types are invariant (
Option<Integer>is notOption<Float>)
Strings and None
import std.io.*;
function logDone(): None {
println("done");
return None;
}
function main(): None {
text: String = "Arden";
logDone();
return None;
}
Reference Types
Arden supports borrowed references:
&Timmutable reference&mut Tmutable reference
function main(): None {
mut x: Integer = 1;
{
r: &Integer = &x;
_v: Integer = *r;
};
rx: &mut Integer = &mut x;
*rx = 2;
return None;
}
Reference safety rules are documented in Ownership and Borrowing.
Composite Types
List<T>- ordered dynamic collectionMap<K, V>- key/value collectionSet<T>- unique-value collectionRange<T>- iterator-like range type- classes, enums, interfaces
See Collections and feature docs for details.
Built-in Generic Constructors
Constructor argument shapes are checked statically:
List<T>()andList<T>(capacity: Integer)are validMap<K, V>(),Set<T>(),Option<T>(),Result<T, E>()take no value args- incompatible arity/types are compile errors
Important default-constructor behavior:
Option<T>()initializes toNoneResult<T, E>()initializes toError(...)default ofE
For readability, prefer explicit constructors in business logic:
Option.none()/Option.some(v)Result.error(e)/Result.ok(v)
Task<T> and Ptr<T> (Compiler Feature)
Arden type system includes:
Task<T>for async valuesPtr<T>for low-level FFI pointer surfaces
Important: these are not normal constructor-based runtime collections. Treat them as special language/runtime boundary types.
Use async/await APIs for Task<T> flows and extern boundaries for Ptr<T> usage.