Print ordering
This commit is contained in:
parent
18dd532df2
commit
fe9d836942
|
@ -54,7 +54,10 @@ label-`Value` followed by its field-`Value`s.
|
||||||
curly-brace-enclosed colon-separated pairs of values. `Set`s are
|
curly-brace-enclosed colon-separated pairs of values. `Set`s are
|
||||||
written as values enclosed by the tokens `#{` and
|
written as values enclosed by the tokens `#{` and
|
||||||
`}`.[^printing-collections] It is an error for a set to contain
|
`}`.[^printing-collections] It is an error for a set to contain
|
||||||
duplicate elements or for a dictionary to contain duplicate keys.
|
duplicate elements or for a dictionary to contain duplicate keys. When
|
||||||
|
printing sets and dictionaries, implementations *SHOULD* order
|
||||||
|
elements resp. keys with respect to the [total order over
|
||||||
|
`Value`s](preserves.html#total-order).[^rationale-print-ordering]
|
||||||
|
|
||||||
Sequence = "[" *Value ws "]"
|
Sequence = "[" *Value ws "]"
|
||||||
Dictionary = "{" *(Value ws ":" Value) ws "}"
|
Dictionary = "{" *(Value ws ":" Value) ws "}"
|
||||||
|
@ -68,6 +71,12 @@ duplicate elements or for a dictionary to contain duplicate keys.
|
||||||
commas separating, and commas terminating elements or key/value
|
commas separating, and commas terminating elements or key/value
|
||||||
pairs within a collection.
|
pairs within a collection.
|
||||||
|
|
||||||
|
[^rationale-print-ordering]: **Rationale.** Consistently printing
|
||||||
|
the elements of unordered collections in some arbitrary but stable
|
||||||
|
order helps, for example, keep diffs small and somewhat meaningful
|
||||||
|
when Preserves values are pretty-printed to text documents under
|
||||||
|
source control.
|
||||||
|
|
||||||
`Boolean`s are the simple literal strings `#t` and `#f` for true and
|
`Boolean`s are the simple literal strings `#t` and `#f` for true and
|
||||||
false, respectively.
|
false, respectively.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue