Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

Bindings & mutability

Choose what can change.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Runtime bindings

let Name: str = "Player";
let Count = 4;
var Health: f32 = 100.0;
var Index = 0;

let creates a read-only binding. var creates writable storage. Both require an initializer, and a runtime type annotation can be inferred from it.

Compile-time constants

const MaxPlayers: usize = 64;

const declares a compile-time value and requires an explicit type. It does not mean runtime read-only access.

Binding and access are different

var Pointer: i32* = GetPointer();
let WritablePointer: mut i32* = GetWritablePointer();

These are illustrative fragments requiring the named functions. The first binding can be reassigned while its pointee is read-only. The second fixes the pointer value but permits mutation through it. readonly is shallow and does not freeze other aliases.

Parameters

Parameters are binding-readonly by default. mut Name: T grants writable owned parameter storage. Type-position mut, as in mut T&, grants writable access through a reference.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library