Targets · Swift · 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 Swift, which nests just as deeply.
Contents
How a Program becomes Swift, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Swift target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the Swift it renders to.
- Naming considerations — how Program's dotted names are carried into Swift.
- Entry point — starting a program and mounting it as a SwiftUI app.
- Drivers — the native drivers that provide the interface, animation and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written Swift behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Swift.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Swift keeps for itself, and how a colliding name is escaped.
How it looks
Swift is one of the good cases: the dotted name is kept exactly as written, every segment a real type.
Ui.Button.Integer.Increment(count, { … }) // verbatim, four real dots
The natural idiom
Swift has genuine nested types — an enum, struct or class
can contain another. A caseless enum is the idiomatic namespace: it holds only static
members and cannot be instantiated, which is exactly what a Program module is.
Keeping the real dotted name
No faking is needed. Each namespace segment becomes a nested caseless enum, and the
leaf is a public static func inside it — so the dotted path is a real, compiler
resolved member chain.
enum Ui {
enum Button {
enum Integer {
public static func Increment(_ count: ReactiveValue<Int>, _ body: () -> Void) { … }
}
}
}
// the call is the Program name, unchanged:
Ui.Button.Integer.Increment(count, { … })
A record TYPE is a struct in its namespace path,
a union TYPE an enum with cases; a built-in value
type folds to a native type (Maths.Integer → Int).
Recommendation
Use nested caseless enums. Swift keeps every dot real, at both the value and the type
level, with no compromise — the same as Rust
(::) and Zig (struct
containers), 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.