Targets · Rust · Naming considerations
Naming considerations
A Program name nests to any depth — Ui.Button.Integer.Increment. This page is how
that dotted name is carried into Rust, which nests just as deeply.
Contents
How a Program becomes Rust, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Rust target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a crate.
- Example — a full program using every keyword, and the Rust it renders to.
- Naming considerations — how Program's dotted names are carried into Rust.
- Entry point — starting a program from
mainwith its drivers. - Drivers — the native drivers that provide the interface, console and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written Rust behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Rust.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Rust keeps for itself, and how a colliding name is escaped.
How it looks
Rust keeps the full path, lowercased to snake_case and joined with :: instead of a dot.
ui::button::integer::Increment(count, Box::new(move || { … })); // was Ui.Button.Integer.Increment
The natural idiom
Rust modules nest exactly like Program's, so this is the natural idiom — nothing has
to be faked. The only cosmetic difference is the separator: Rust uses :: where Program
uses ., and module segments are conventionally snake_case.
Keeping the real dotted name
Each namespace segment becomes a nested mod, and the leaf a pub fn inside
it, so the path is a genuine, compiler-resolved module chain — every level real.
pub mod ui {
pub mod button {
pub mod integer {
pub fn Increment(count: ReactiveValue<i64>, body: Box<dyn Fn()>) { … }
}
}
}
// the call is the Program name, with :: for the dots:
ui::button::integer::Increment(count, Box::new(move || { … }));
A record TYPE is a pub struct in its module path,
a union TYPE a pub enum; a built-in value type folds
to a native type (Maths.Integer → i64).
Recommendation
Use nested mods with ::. Rust keeps every level of the name real, at both
the value and the type level, with no compromise beyond the separator — the same as
Swift and
Zig, and unlike
Dart and
Go, which must join with an underscore. The
only identifiers ever rewritten are ordinary names that collide with a
reserved word.