Targets · Dart · 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 Dart, which has no matching nesting.
Contents
How a Program becomes Dart, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Dart 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 Dart it renders to.
- Naming considerations — how Program's dotted names are carried into Dart.
- Entry point — starting a program and mounting it as a Flutter 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 Dart behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Dart.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Dart keeps for itself, and how a colliding name is escaped.
How it looks
Dart keeps the last segment as a member and joins everything before it with an underscore into one class name.
Ui_Button_Integer.Increment(count, () { … }); // was Ui.Button.Integer.Increment
The natural idiom
Dart has libraries and classes, but no arbitrarily nested namespaces you can dot into. The natural
way to group static functions is a class of statics — MathsReal.multiply(...)
— which is a single flat level. Beyond that, idiomatic Dart reaches for separate libraries and
imports, which drop the dotted shape entirely.
Can the real dotting be faked?
Only for the last dot. Dart member access (a.b) needs a to be a real
object or class, and a class cannot itself contain another dottable class as a plain member path. So
Ui.Button.Integer.Increment cannot be four genuine dots. The honest, collision-proof
choice is to join the namespace with an underscore and keep the final segment as
the member:
// Ui.Button.Integer.Increment -> a class + a static method
final class Ui_Button_Integer {
static void Increment(ReactiveValue<int> count, void Function() body) { … }
}
// the call keeps one real dot:
Ui_Button_Integer.Increment(count, () { … });
Because _ is illegal in a Program identifier, the join is unambiguous and can never
collide with a written name. A record TYPE becomes a
final class named the same way, or a native primitive for a built-in value type
(Maths.Integer → int).
Recommendation
Use the underscore join. It is not the full dotted notation — only the final access is a real
dot — but it is unambiguous, reversible, and reads closely to the source
(Ui_Button_Integer.Increment). Every top module is one Dart library; the segments below
it fold into class names. It is the same compromise Go
makes, and the opposite of Swift, which
keeps every dot.