You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/SPECIFICATION.html
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,9 @@
96
96
97
97
For`INT`and`FLT`types,adeclarationMAYnameaspecificnumericbasebywriting`TYPE{base} name`,where`base`isan`INT`literalintherange`2`through`64`.Anamed-basetypeisasubtypeofitsparentnumerictype: `INT{base}`valuesare`INT`sand`FLT{base}`valuesare`FLT`s,butanassignmenttoanamed-basebindingrequiresthevalue's base to match the declared base. The parent types `INT` and `FLT` (equivalent to `INT{0}` and `FLT{0}`) accept values of any valid numeric base.
98
98
99
-
ThefirstassignmenttoasymbolMUSTuseatypedformsuchas`TYPE name = expression`or`TYPE{base} name = expression`,withoneormorespacesbetweenthetypeannotationandthenameandoptionalspacesaround`=`.SubsequentassignmentsMAYomitthetypeannotation,butthesymbol's type MUST remain unchanged for the lifetime of that name, including after deletion and re-assignment.
ThefirstassignmenttoasymbolMUSTuseatypedformsuchas`TYPE name = expression`,`TYPE{base} name = expression`,or`MAP{template} name = expression`,withoneormorespacesbetweenthetypeannotationandthenameandoptionalspacesaround`=`.SubsequentassignmentsMAYomitthetypeannotation,butthesymbol's type MUST remain unchanged for the lifetime of that name, including after deletion and re-assignment.
`INT` and `FLT` additionally support named-base variants written `INT{base}` and `FLT{base}`, where `base` is a numeric base in the range `2` through `64` or `0` to denote the parent type. A named-base type and its parent are the same runtime type, but static type checking treats mismatched bases as incompatible. `INT` and `FLT` (base `0`) accept any valid numeric base; `INT{base}` and `FLT{base}` only accept values whose stored base equals the declared base.
178
180
181
+
`MAP` additionally supports named-template variants written `MAP{template}`, where `template` is any expression that evaluates to a `MAP`. A named-template type and its parent are the same runtime type, but static type checking treats mismatched templates as incompatible. `MAP` accepts any `MAP` value; `MAP{template}` only accepts values whose entries satisfy the template under the default key-presence rules of the `MATCH` operator. Named `MAP` types with different templates are treated as distinct types.
182
+
179
183
---
180
184
181
185
### 4.0 Booleans
@@ -438,6 +442,8 @@
438
442
439
443
`INT` and `FLT` type annotations MAY include a base specifier written immediately after the type name with no intervening whitespace, in the form `INT{base}` or `FLT{base}`. The `{base}` suffix is part of the type annotation and therefore MUST appear before the required space that separates the type from the declared name. For example, `INT{0d2}value` declares a binary integer, while `FLT{0x}value` declares a hexadecimal float. A base of `0` (typically written as the bare type name) denotes the parent type and accepts any valid numeric base.
440
444
445
+
`MAP` type annotations MAY include a template specifier written immediately after the type name with no intervening whitespace, in the form `MAP{template}`. The `{template}` suffix is part of the type annotation and therefore MUST appear before the required space that separates the type from the declared name. For example, `MAP{<"x"=0d1>}value` declares a map that requires an `"x"` key with integer value. The `template` MUST evaluate to a `MAP`. Signatures produced by the `SIGNATURE` built-in MUST include the template in the type annotation for named `MAP` bindings.
446
+
441
447
Reading an undeclared symbol, a declared-but-never-assigned symbol, or a deleted symbol MUST raise a runtime error. Removing a binding MUST preserve its recorded static type, so any later re-assignment to the same name MUST still match the original type.
442
448
443
449
Re-assignment MUST preserve the declared type for the lifetime of the symbol, including after deletion and re-creation. Symbol existence, lifetime, and mutability MAY be inspected or modified only through the language's dedicated symbol-management facilities.
0 commit comments