Variables & Types
Bindings (let/var), annotations, and the core built-in types.
Variables & Types
Variables and local type reasoning are among the most stable parts of the current language surface. This page focuses on the forms you can safely show in examples today and on how they interact with the current checker stack.
Current contract
letis the default immutable binding form.varis available for mutable locals and loop-style state.- Straightforward local inference works well, but explicit annotations are still the safest way to document values that interact with units, effects, or epistemic boundaries.
- Tuple, array, and scalar-style local bindings remain good teaching material because they show up consistently in examples and tests.
Common patterns
let x = 42
let ratio: f64 = 0.5
let pair = (x, ratio)
var total = x
total = total + 1
Where to inspect the checker
self-hosted/check/types.sioandself-hosted/check/infer.sioare the most relevant modules for local typing and inference work.self-hosted/check/env.siotracks the evolving environment model for bindings.self-hosted/check/units.sioandself-hosted/check/epistemic.sioare where ordinary locals begin to interact with domain-specific typing rules.
Guidance for real code
- Use inferred locals for small, obvious values and explicit annotations where you want the docs or diagnostics to stay unambiguous.
- Treat older examples that look too Rust-like, Julia-like, or Python-like with suspicion; Sounio has its own syntax and semantics.
- When in doubt, validate the exact snippet with
souc checkinstead of relying on memory.