- From: Jeffrey Yasskin <notifications@github.com>
- Date: Wed, 22 Feb 2017 12:49:23 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/pull/317/review/23325797@github.com>
jyasskin commented on this pull request. > @@ -4104,6 +4107,10 @@ the value to use for the dictionary member when passing a value to a not have a specified value. Dictionary members with default values are always considered to be present. +An [=ordered map=] with string [=map/keys=] can be implicitly treated as a dictionary value of a +specific dictionary |D| if all of its [=map/entries=] correspond to dictionary members, in the Do you want to also enforce `required` fields here? > @@ -5662,7 +5669,10 @@ identifies a [=dictionary=] is used to refer to a type that corresponds to the set of all dictionaries that adhere to the dictionary definition. -There is no way to represent a constant dictionary value in IDL. +The literal syntax for [=ordered maps=] may also be used to represent dictionaries, when it is \o/ > @@ -5792,22 +5804,20 @@ The [=type name=] of a sequence type is the concatenation of the type name for |T| and the string “Sequence”. +Any [=list=] can be implicitly treated as a sequence, as long as it contains only [=list/items=] Maybe "… as a `sequence<T>`, … that are of type `T`."? > -However, there is no way to represent a constant record value in IDL. +A <dfn export>record type</dfn> is a parameterized type whose values are [=ordered maps=] with +[=map/keys=] that are instances of |K| and [=map/values=] that are instances of |V|. |K| must be one +of {{DOMString}}, {{USVString}}, or {{ByteString}}. The order of a record's [=map/entries=] is We can probably drop the "The order of a record's entries ..." sentence now. I feel like that's obvious from it being an ordered map. > @@ -5822,6 +5832,11 @@ Records must not be used as the type of an [=attribute=] or The [=type name=] of a record type is the concatenation of the type name for |K|, the type name for |V| and the string “Record”. +Any [=ordered map=] can be implicitly treated as a record, as long as it contains only Similar to sequence, `as a `record<K, V>` might be clearer, and might let you omit the "Additionally..." sentence since the restriction on *K* was already stated above. > @@ -7415,17 +7430,17 @@ ECMAScript <emu-val>Object</emu-val> values. [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>. 1. Let |result| be a new empty instance of <code>[=record=]<|K|, |V|></code>. 1. Let |keys| be [=?=] |O|.\[[OwnPropertyKeys]](). - 1. Repeat, for each element |key| of |keys| in [=List=] order: + 1. Repeat, [=list/for each=] element |key| of |keys|: s/Repeat, // I think. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/heycam/webidl/pull/317#pullrequestreview-23325797
Received on Wednesday, 22 February 2017 20:49:56 UTC