diff --git a/preserves-schema.md b/preserves-schema.md index 8c41258..77fc281 100644 --- a/preserves-schema.md +++ b/preserves-schema.md @@ -179,7 +179,7 @@ are *merged* together. #### Experimental. 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 . 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 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. 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 `< ... >` record: - RecordPattern = "<" value *(NamedPattern) ">" - / "<" NamedPattern *(NamedPattern) ">" + RecordPattern = "<" NamedPattern *(NamedPattern) ">" + / "<" value *(NamedPattern) ">" A tuple pattern matches a fixed-length sequence with specific patterns in each position. A variable tuple pattern is the same, but with an