Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Keywords

Aura has sixteen reserved words. None of them can name a binding, a function, a schema or an unquoted key: type = 1 is a syntax error. A key that has to be one of these words is written as a string, and read the same way (D11): "type": "service", then o."type".

WordWhat it doesExampleDecision
importBrings in another module, a registry package with a pinned version, or a module the host providesimport "./lib.aura" as libD8, D12, D35
asNames what import brought in; only after an importimport org/net@v1.2 as netD12
typeDeclares a schema: fields with types, defaults and invariants. A field typed by a schema holds only what new of it would accepttype Port … endD15, D26, D27, D28, D41
enumDeclares a closed set of strings for a schema fieldenum Tier … endD18
defDeclares a named function. It returns the object of its properties, or its last expression when it ends in onedef labels(team) … endD17, D40
endCloses every block: objects, def, type, enum, domain, cond, new, a multi-line lambda and a text stringtls: enabled: true endD3, D38
domainA named section with its own scope: its label becomes the key, and its body may computedomain "production" … endD17
newBuilds a schema instance and checks itnew Port number: 443 endD4, D38
assertA check that stops evaluation with a message; inside a type, an invariant carried with the schemaassert replicas > 0, "need one"D5, D28
shadowRebinds a name from an outer scope - without it, that is E0302shadow port = 9090D7
pubMakes a def, type or enum importable; properties are always visiblepub def service(name)D12
condA choice between several values, the first true arm winscond … else -> "dev" … endD14
elseThe last arm of a cond, required so every path has a valueelse -> "dev"D14
trueThe Bool true. There is no truthiness: a condition that is not a Bool is E0306tls: true-
falseThe Bool falsedebug: false-
nullThe absence of a value. A schema field takes it only when its type is marked ?, and it is never rendered as textquota: Int? = nullD27, D31

Not reserved

WordWhat it doesExampleDecision
textOpens a block string, but only where a value is expected - key: text or x = text at the end of a line. Everywhere else it is an ordinary name, so a field called text keeps workingbody: text … endD16

The type names - String, Int, Float, Bool, List, Object - are not keywords either: they are names the schema checker knows. The decisions in the last column are in the decision log of the specification.