Previous page Table of Contents Next page
The syntactic type typed-variable is defined in the compiler module. It has slots for name and type. The name is the name of a variable. The term "variable" is used for traditional reasons, although almost all uses of typed-variable create fixed definitions, so the "variable" cannot actually vary, once defined. The type is an expression that must evaluate to a type. The value of the variable is restricted to be a member of this type.
The syntax for a typed-variable is a variable name optionally followed by the bound particle is and a type specifier (see the next section). If just a variable name is specified with no type restriction, the type defaults to anything.
A variable name consists of either a name that is not punctuation and is not visibly defined as an operator or macro, or a backslash followed by any name or a string that gets converted to a name.
Examples:
def pi = 3.14159 def pi is float = 3.14159 def \"22/7" = 3.14159 def y is integer-above(0) or false := z def w is 64 bits = 1234567890
The syntactic type defaulted-typed-variable is defined in the compiler module as a subclass of typed-variable. It adds a default-expression slot. The default-expression function applied to a plain typed-variable always returns the name false.
The syntax for a defaulted-typed-variable is a typed-variable optionally followed by the bound particle "=" and a default value expression.
Previous page Table of Contents Next page