Language reference · section 31
31. Keywords
Reserved words cannot name a binding, a parameter, or a function. The list matches the lexer in crates/pin-compiler/src/lexer.rs.
Feature: Keywords
Scenario: A reserved word cannot name a binding
Given a reserved word such as try, catch, finally, yield, or break
When the code uses it as a binding name
Then the compiler reports an error
Scenario: A reserved word can name a property after a dot
Given the code "promise.catch(f)"
Then the code is valid
Reserved words:
fn return if else while for in of const mut true false null and or not is isnt
when throw by class extends match from import export default async await yield
break try catch finally requires ensures assert then new
Words that have a meaning but are not reserved:
_is the typed hole and the wildcard.resultis the return value insideensures.thisis the receiver inside a class method.constructoris the name of a class method.teststarts a test block when it is followed by a string and a colon.regex,find,part,matches, andrejectshave meaning only inside a regex block.transferis a built-in function for workers. A program may define its owntransfer.