Skip to main content

Reserved Keywords

The lexer keyword map contains 41 entries. Most cannot be used as names. The four contextual testing words remain legal identifiers where a testing marker is not expected; their reservation is contextual, not global. case is an ordinary identifier, not a keyword. No words are released by this diagnostic change.

A reserved word in a parameter name produces PAR_RESERVED_KEYWORD at that word. The invalid parameter is dropped for parser recovery; the source still fails checking. Record-type fields retain PAR_FIELD_NAME_EXPECTED with a reservation explanation. Rename the parameter and all of its uses before checking again.

Complete keyword map​

WordCurrent use or reservation, owner and trigger
funcFunction declaration or parenthesized function literal.
purePure function marker.
letImmutable binding.
letrecRecursive binding.
inBinding scope.
ifConditional or match guard.
thenConditional true branch.
elseConditional false branch.
matchPattern matching with braces (no with).
withPAR019 dialect detection and planned effect-handler syntax. Handler lane: consume or release at syntax freeze. Alternatives: using, given, w.
typeType declaration.
classType-class declaration syntax.
instanceType-class instance syntax.
moduleModule declaration.
importImport declaration.
exportExport marker.
externExternal declaration.
forallUniversal type quantification.
existsReserved for existential type quantification; the type-system lane must consume or release it at syntax freeze.
testContextual named test marker; also a legal identifier.
testsContextual test block marker; also a legal identifier.
propertyContextual property marker; also a legal identifier.
propertiesContextual property block marker; also a legal identifier.
assertReserved for planned assertion builtin; assertion/testing lane must consume or release at syntax freeze. Alternatives: check, verify.
spawnReserved for planned concurrency lane (CSP/session types). Consume or release at concurrency syntax freeze. Alternatives: chan, fork, concurrent, pick.
parallelReserved for planned concurrency lane (CSP/session types). Consume or release at concurrency syntax freeze. Alternatives: chan, fork, concurrent, pick.
selectReserved for planned concurrency lane (CSP/session types). Consume or release at concurrency syntax freeze. Alternatives: chan, fork, concurrent, pick.
channelReserved for planned concurrency lane (CSP/session types). Consume or release at concurrency syntax freeze. Alternatives: chan, fork, concurrent, pick.
sendReserved for planned CSP/session-types lane. CSP lane: consume or release at syntax freeze. Alternatives: tx, rx, deadline, expires.
recvReserved for planned CSP/session-types lane. CSP lane: consume or release at syntax freeze. Alternatives: tx, rx, deadline, expires.
timeoutReserved for planned CSP/session-types lane. CSP lane: consume or release at syntax freeze. Alternatives: tx, rx, deadline, expires.
asImport alias.
derivingType-class derivation.
requiresPrecondition contract.
ensuresPostcondition contract.
invariantInvariant contract.
trueBoolean literal.
falseBoolean literal.
notBoolean negation.
andBoolean conjunction.
orBoolean disjunction.

Reservation decisions​

The effect-handler lane owns the proposed handle ... with syntax. Its syntax freeze must explicitly consume with as syntax or release it. This is separate from its current PAR019 role: match x with { ... } is rejected with the existing dialect diagnostic; AILANG uses match x { ... } and guards use if.

The CSP/session-types lane owns channel communication and concurrency reservations. Its examples are unfrozen sketches, including function-form receive/send; they do not establish that those words need keyword status. At syntax freeze the lane must explicitly consume or release each listed word. The assertion/testing lane has the same obligation for its planned assertion builtin (see the named-test assertion plan). No syntax-freeze decision is made here. Until its owner rules, each reservation remains. A release must update the keyword map, token enum, token strings, IsKeyword, and this reference together.

Working rename example​

module examples/runnable/reserved_keyword_names

pure func combine(a: int, rx: int, b: int) -> int = a + rx + b
pure func usingValue(using: int) -> int = using
export pure func main() -> int = combine(1, 2, 3) + usingValue(4)

Use ailang check examples/runnable/reserved_keyword_names.ail to check the corrected three-parameter call. Recovery of an invalid parameter is not a successful type check and does not preserve a three-argument call's arity.

See Language Syntax, or run ailang prompt for the current teaching prompt and ailang check file.ail for diagnostics.