Correct schema spec and note different usages of @name. Closes #31.
This commit is contained in:
parent
ee0f9a79fd
commit
55deeea343
|
@ -4,7 +4,7 @@ title: "Preserves Schema"
|
||||||
---
|
---
|
||||||
|
|
||||||
Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||||
February 2023. Version 0.3.2.
|
October 2023. Version 0.3.3.
|
||||||
|
|
||||||
[abnf]: https://tools.ietf.org/html/rfc7405
|
[abnf]: https://tools.ietf.org/html/rfc7405
|
||||||
|
|
||||||
|
@ -207,20 +207,26 @@ definition-unique *name*. The name is used to uniquely label the
|
||||||
alternative's host-language representation (for example, a subclass, or
|
alternative's host-language representation (for example, a subclass, or
|
||||||
a member of a tagged union type).
|
a member of a tagged union type).
|
||||||
|
|
||||||
A variant name can either be given explicitly as `@name` (see discussion
|
A variant name can either be given explicitly as `@name` or
|
||||||
of `NamedPattern` below) or inferred. It can only be inferred from the
|
inferred.[^variant-names-unlike-binding-names] It can only be inferred
|
||||||
label of a record pattern, from the name of a reference to another
|
from the label of a record pattern, from the name of a reference to
|
||||||
definition, or from the text of a "sufficiently identifierlike" literal
|
another definition, or from the text of a "sufficiently identifierlike"
|
||||||
pattern - one that matches a string, symbol, number or boolean:
|
literal pattern - one that matches a string, symbol, number or boolean:
|
||||||
|
|
||||||
AltPattern = "@" id SimplePattern
|
AltPattern = "@" id Pattern
|
||||||
/ "<" id PatternSequence ">"
|
/ "<" id PatternSequence ">"
|
||||||
/ Ref
|
/ Ref
|
||||||
/ LiteralPattern -- with a side condition
|
/ LiteralPattern -- with a side condition
|
||||||
|
|
||||||
A host language will likely use the same ordering of its types as
|
[^variant-names-unlike-binding-names]: Note that explicitly-given
|
||||||
specified by the schema. It is therefore recommended to specify first
|
*variant* names are unlike *binding* names in that binding names give
|
||||||
the alternative best suited as a default initialization value (if
|
rise to a field in the record type for a definition, while variant
|
||||||
|
names are used as labels for alternatives in a sum type for a
|
||||||
|
definition.
|
||||||
|
|
||||||
|
A host language will likely use the same ordering of variants in a sum
|
||||||
|
type as specified by the schema. It is therefore recommended to specify
|
||||||
|
first the alternative best suited as a default initialization value (if
|
||||||
there is any).
|
there is any).
|
||||||
|
|
||||||
### Intersection definitions.
|
### Intersection definitions.
|
||||||
|
|
Loading…
Reference in New Issue