Tweaks
This commit is contained in:
parent
947b816a57
commit
a44884d9f5
|
@ -179,7 +179,7 @@ are *merged* together.
|
||||||
#### Experimental.
|
#### Experimental.
|
||||||
|
|
||||||
Intersections are an experimental feature. They can be used to express
|
Intersections are an experimental feature. They can be used to express
|
||||||
*optional dictionary entries*:
|
*optional dictionary entries*:[^not-ideal-optional-encoding]
|
||||||
|
|
||||||
MyDict = {a: int, b: string} & @c MaybeC .
|
MyDict = {a: int, b: string} & @c MaybeC .
|
||||||
MaybeC = @present {c: symbol} / @absent {} .
|
MaybeC = @present {c: symbol} / @absent {} .
|
||||||
|
@ -188,6 +188,11 @@ It is not yet clear whether they pull their weight. In particular, the
|
||||||
semantics of serializing a value defined by intersection are not
|
semantics of serializing a value defined by intersection are not
|
||||||
completely clear.
|
completely clear.
|
||||||
|
|
||||||
|
[^not-ideal-optional-encoding]: This encoding is not ideal. Given a
|
||||||
|
term `{a: 1, b: "", c: sym}`, it will yield a `present` result,
|
||||||
|
and given `{a: 1, b: ""}`, will yield an `absent` result; but
|
||||||
|
`absent` will also result from `{a: 1, b: "", c: "notasymbol"}`.
|
||||||
|
|
||||||
### Patterns.
|
### Patterns.
|
||||||
|
|
||||||
Pattern = SimplePattern / CompoundPattern
|
Pattern = SimplePattern / CompoundPattern
|
||||||
|
@ -262,8 +267,8 @@ A record pattern matches an input record. It may be specified as a
|
||||||
record with a literal in the label position, or as a quoted `<<rec>
|
record with a literal in the label position, or as a quoted `<<rec>
|
||||||
... >` record:
|
... >` record:
|
||||||
|
|
||||||
RecordPattern = "<" value *(NamedPattern) ">"
|
RecordPattern = "<<rec>" NamedPattern *(NamedPattern) ">"
|
||||||
/ "<<rec>" NamedPattern *(NamedPattern) ">"
|
/ "<" value *(NamedPattern) ">"
|
||||||
|
|
||||||
A tuple pattern matches a fixed-length sequence with specific patterns
|
A tuple pattern matches a fixed-length sequence with specific patterns
|
||||||
in each position. A variable tuple pattern is the same, but with an
|
in each position. A variable tuple pattern is the same, but with an
|
||||||
|
|
Loading…
Reference in New Issue