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
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -96,9 +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.
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.
101
+
ThefirstassignmenttoasymbolMUSTuseatypedformsuchas`TYPE name = expression`,`TYPE{base} name = expression`,or`MAP{schema} 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.
180
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.
181
+
`MAP` additionally supports named-schema variants written `MAP{schema}`, where `schema` is any expression that evaluates to a `MAP`. A named-schema type and its parent are the same runtime type, but static type checking treats mismatched schemas as incompatible. `MAP` accepts any `MAP` value; `MAP{schema}` only accepts values whose entries satisfy the schema under the default key-presence rules of the `MATCH` operator. Named `MAP` types with different schemas are treated as distinct types.
182
182
183
183
---
184
184
@@ -444,7 +444,7 @@
444
444
445
445
`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.
446
446
447
-
`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.
447
+
`MAP` type annotations MAY include a schema specifier written immediately after the type name with no intervening whitespace, in the form `MAP{schema}`. The `{schema}` 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 `schema` MUST evaluate to a `MAP`. Signatures produced by the `SIGNATURE` built-in MUST include the schema in the type annotation for named `MAP` bindings.
448
448
449
449
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.
450
450
@@ -841,7 +841,7 @@
841
841
842
842
- `BOOLKEYIN(INT|FLT|STRkey,MAPmap)` and `BOOLVALUEIN(ANYvalue,MAPmap)` = MUST return `TRUE` when the given key or value occurs in `map` and `FALSE` otherwise.
843
843
844
-
- `BOOLMATCH(MAPmap,MAPtemplate,INTtyping=0,INTrecurse=0,INTshape=0)` = MUST return `TRUE` if every key in `template` is present in `map` and, when `typing`, `shape`, or `recurse` is nonzero, the corresponding matched values also satisfy type, shape, and recursive nesting constraints. If `template` contains a key `"match"` whose value is a `MAP`, that entry is metadata and is not itself required in `map`: the effective value of each parameter is the explicit keyword argument if supplied, otherwise the metadata subkey if present and valid, otherwise the implicit default `0`. Each metadata key MUST be an `INT`, and an invalid `"match"` entry, unknown metadata subkey name, or metadata subkey value that is not `INT` MUST cause `MATCH` to return `FALSE` rather than raising an error. A non-`MAP` `"match"` value is matched as an ordinary key.
844
+
- `BOOLMATCH(MAPmap,MAPschema,INTtyping=0,INTrecurse=0,INTshape=0)` = MUST return `TRUE` if every key in `schema` is present in `map` and, when `typing`, `shape`, or `recurse` is nonzero, the corresponding matched values also satisfy type, shape, and recursive nesting constraints. If `schema` contains a key `"match"` whose value is a `MAP`, that entry is metadata and is not itself required in `map`: the effective value of each parameter is the explicit keyword argument if supplied, otherwise the metadata subkey if present and valid, otherwise the implicit default `0`. Each metadata key MUST be an `INT`, and an invalid `"match"` entry, unknown metadata subkey name, or metadata subkey value that is not `INT` MUST cause `MATCH` to return `FALSE` rather than raising an error. A non-`MAP` `"match"` value is matched as an ordinary key.
845
845
846
846
- `MAPINV(MAPmap)` = MUST return a new map whose keys and values are reversed. Every value in `map` MUST be a scalar key type (`INT`, `FLT`, or `STR`), and duplicate values MUST raise a runtime error.
0 commit comments