[whatwg/webidl] Make the dictionary <-> ordered map correspondence clearer about order (Issue #1257)

[Dictionary members have an order](https://webidl.spec.whatwg.org/#dfn-dictionary:~:text=The%20order%20of%20the,that%20comprise%20their%20identifiers):

> The order of the [dictionary members](https://webidl.spec.whatwg.org/#dfn-dictionary-member) on a given dictionary is such that inherited dictionary members are ordered before non-inherited members, and the dictionary members on the one dictionary definition (including any partial dictionary definitions) are ordered lexicographically by the Unicode codepoints that comprise their identifiers.

But the places that talk about the dictionary <-> Infra ordered map correspondence, namely [1](https://webidl.spec.whatwg.org/#dfn-dictionary:~:text=A%20dictionary%20is%20a%20definition%20%28matching%20Dictionary%29%20used%20to%20define%20an%20ordered%20map%20data%20type):

> A dictionary is a definition (matching [Dictionary](https://webidl.spec.whatwg.org/#prod-Dictionary)) used to define an [ordered map](https://infra.spec.whatwg.org/#ordered-map) data type with a fixed, ordered set of [entries](https://infra.spec.whatwg.org/#map-entry), termed dictionary members, where [keys](https://infra.spec.whatwg.org/#map-getting-the-keys) are strings and [values](https://infra.spec.whatwg.org/#map-getting-the-values) are of a particular type specified in the definition.

and [2](https://webidl.spec.whatwg.org/#dfn-dictionary:~:text=An%20ordered%20map%20with%20string%20keys%20can%20be%20implicitly%20treated%20as%20a%20dictionary%20value%20of%20a%20specific%20dictionary%20D%20if%20all%20of%20its%20entries%20correspond%20to%20dictionary%20members%2C%20as%20long%20as%20those%20entries%20have%20the%20correct%20types%2C%20and%20there%20are%20entries%20present%20for%20any%20required%20or%20defaulted%20dictionary%20members):

> An [ordered map](https://infra.spec.whatwg.org/#ordered-map) with string [keys](https://infra.spec.whatwg.org/#map-getting-the-keys) can be implicitly treated as a dictionary value of a specific dictionary D if all of its [entries](https://infra.spec.whatwg.org/#map-entry) correspond to [dictionary members](https://webidl.spec.whatwg.org/#dfn-dictionary-member), as long as those [entries](https://infra.spec.whatwg.org/#map-entry) have the correct types, and there are entries present for any [required](https://webidl.spec.whatwg.org/#required-dictionary-member) or [defaulted](https://webidl.spec.whatwg.org/#dfn-dictionary-member-default-value) dictionary members.

do not mention this specific order. In particular it might be confusing what happens if someone writes a spec using [ordered map literal syntax](https://infra.spec.whatwg.org/#maps) where the keys are not listed in the canonical order.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1257
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1257@github.com>

Received on Thursday, 26 January 2023 02:10:54 UTC