Types
Vow has no null. Optional and fallible values use Option and Result from the prelude.
Primitives and collections
Section titled “Primitives and collections”| Type | Notes |
|---|---|
int |
Default integer width on the native path |
int64 |
Wider integer; no implicit mix with int — use as |
f32 / f64 |
Floats + casts (phase2_collections.vow) |
bool |
true / false |
String |
Heap string; len(s), concat, trim/replace/split/join |
Array<T> |
Index, .len(), array_push, index assign, for x in xs |
Map<String, V> |
String keys only (v1); map_new / map_get / map_set / len |
// fragment-onlylet wide = n as int64;let ratio = 0.5 as f64;Structs, enums, match
Section titled “Structs, enums, match”class ≡ struct. Enums construct with Shape::Circle(2); match patterns use bare variants (Circle(r), not Shape::Circle(r)). Matches must be exhaustive.
Single inheritance ships: open class / extends / mandatory override (inheritance.vow). Dispatch is static.
Interfaces — static and dyn
Section titled “Interfaces — static and dyn”// fragment-onlyfn total_area(shapes: Array<dyn Shape>) -> int { var sum = 0; for s in shapes { sum = sum + s.area(); } return sum;}Static interface parameters are monomorphized. Heterogeneous collections use dyn Interface + vtables (tests/lang/dyn_shapes.vow in a repo clone).
Type aliases, function values, lambdas
Section titled “Type aliases, function values, lambdas”// fragment-onlytype Score = int;
fn double(x: int) -> int { return x * 2; }
let ys = array_map(xs, double);let zs = array_map(xs, (x: int) -> x * 3);let evens = array_filter(xs, is_even);Capability types
Section titled “Capability types”Opaque: FsRead, FsWrite, Net, Env, Clock, Rand, Proc, Threads, and the bundle Caps.
- OOP — classes, interfaces, inheritance, chaining
- Errors and Option
- Syntax