Keywords
How each of Program's keywords is rendered into Dart.
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.
Program keywords in Dart
Each of Program's keywords maps to idiomatic Dart. Names join with an underscore into one
final class (see the example); the
reactive keywords are calls into the runtime. Follow a keyword's own page for the full rendering
and the other targets.
| Keyword | Rendered Dart |
|---|---|
MODULE | Underscore-joined into one final class — Ui.Button.Integer becomes Ui_Button_Integer. |
TYPE | A record becomes final class Point { final double x; final double y; Point(this.x, this.y); }; a union becomes a sealed class with one final class per option. |
FUNCTION | static ReactiveValue<T> Name(…) { … return …; }. |
NATIVE | A static method whose body is the dart NATIVE string. |
INPUT | A parameter; a BINDING input is read and written. |
HOLE | A trailing Function callback parameter. |
LET | final name = …;. |
STATE | final name = Reactive.State<T>(value);. |
REVERSE | A write-back whose closing SET is Reactive.Set(state, value). |
WITH | Module.With(Name, Replacement, () { … }). |
See JavaScript keywords for the per-keyword
detail and the modifiers; Dart differs in idiom (underscore-joined classes, final
bindings) but the mapping is the same.