Skip to content

Commit b7ac492

Browse files
committed
Formalize value pairs.
1 parent 2aae535 commit b7ac492

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

index.bs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,8 +3990,15 @@ If a single type parameter is given, then the interface has a
39903990
values of the specified type.
39913991
If two type parameters are given, then the interface has a
39923992
<dfn id="dfn-pair-iterator" export>pair iterator</dfn> and provides
3993-
value pairs, where the first value is a key and the second is the
3994-
value associated with the key.
3993+
[=value pairs=] with the given types.
3994+
3995+
A <dfn>value pair</dfn>, given a key type and a value type, is a [=/struct=] with two
3996+
[=struct/items=]:
3997+
1. an [=struct/item=] whose [=struct/name=] is "key", which is referred to as the [=value pair=]'s
3998+
<dfn for="value pair">key</dfn>, and whose value is an IDL value of the key type;
3999+
1. an [=struct/item=] whose [=struct/name=] is "value", which is referred to as the
4000+
[=value pair=]'s <dfn for="value pair">value</dfn>, and whose value is an IDL value of the
4001+
value type.
39954002

39964003
A [=value iterator=]
39974004
must only be declared on an interface
@@ -4005,11 +4012,10 @@ defined to iterate over the object’s indexed properties.
40054012
A [=pair iterator=]
40064013
must not be declared on an interface
40074014
that [=support indexed properties|supports indexed properties=].
4008-
Prose accompanying an interface with a
4009-
[=pair iterator=]
4010-
must define what the list of
4011-
<dfn id="dfn-value-pairs-to-iterate-over" export>value pairs to iterate over</dfn>
4012-
is.
4015+
4016+
Prose accompanying an [=interface=] with a [=pair iterator=] must define a [=/list=] of
4017+
[=value pairs=] for each instance of the [=interface=], which is the list of
4018+
<dfn id="dfn-value-pairs-to-iterate-over" export>value pairs to iterate over</dfn>.
40134019

40144020
<div class="note">
40154021

@@ -4070,8 +4076,9 @@ that have [=members=] with these names.
40704076

40714077
<blockquote>
40724078

4073-
The [=value pairs to iterate over=] are the list of key-value pairs with the key being the username and the
4074-
value being the open <code class="idl">Session</code> object on the <code class="idl">SessionManager</code>
4079+
The [=value pairs to iterate over=] are the list of [=value pairs=] with the
4080+
[=value pair/key=] being the username and the [=value pair/value=] being the open
4081+
<code class="idl">Session</code> object on the <code class="idl">SessionManager</code>
40754082
object corresponding to that username, sorted by username.
40764083

40774084
</blockquote>
@@ -11576,8 +11583,8 @@ then the [=function object=] is {{%ArrayProto_forEach%}}.
1157611583
1. Let |i| be 0.
1157711584
1. While |i| is less than the length of |pairs|:
1157811585
1. Let |pair| be the entry in |pairs| at index |i|.
11579-
1. Let |key| be |pair|’s key.
11580-
1. Let |value| be |pair|’s value.
11586+
1. Let |key| be |pair|’s [=value pair/key=].
11587+
1. Let |value| be |pair|’s [=value pair/value=].
1158111588
1. [=Invoke=] |callback| with |thisArg|
1158211589
(or <emu-val>undefined</emu-val>, if the argument was not supplied)
1158311590
as the [=callback this value=] and |value|, |key| and <b>this</b> as its arguments.
@@ -11784,22 +11791,22 @@ The \[[Prototype]] [=internal slot=] of an [=iterator prototype object=]
1178411791
must be {{%IteratorPrototype%}}.
1178511792

1178611793
<div algorithm>
11787-
The <dfn>iterator result</dfn> for a pair of IDL values |pair| and a kind |kind| is given by the
11794+
The <dfn>iterator result</dfn> for a [=value pair=] |pair| and a kind |kind| is given by the
1178811795
following steps:
1178911796

1179011797
1. Let |result| be a value determined by the value of |kind|:
1179111798
<dl class="switch">
1179211799
: "<code>key</code>"
11793-
:: 1. Let |idlKey| be |pair|’s key.
11800+
:: 1. Let |idlKey| be |pair|’s [=value pair/key=].
1179411801
1. Let |key| be the result of [=converted to an ECMAScript value|converting=] |idlKey| to an ECMAScript value.
1179511802
1. |result| is |key|.
1179611803
: "<code>value</code>"
11797-
:: 1. Let |idlValue| be |pair|’s value.
11804+
:: 1. Let |idlValue| be |pair|’s [=value pair/value=].
1179811805
1. Let |value| be the result of [=converted to an ECMAScript value|converting=] |idlValue| to an ECMAScript value.
1179911806
1. |result| is |value|.
1180011807
: "<code>key+value</code>"
11801-
:: 1. Let |idlKey| be |pair|’s key.
11802-
1. Let |idlValue| be |pair|’s value.
11808+
:: 1. Let |idlKey| be |pair|’s [=value pair/key=].
11809+
1. Let |idlValue| be |pair|’s [=value pair/value=].
1180311810
1. Let |key| be the result of [=converted to an ECMAScript value|converting=] |idlKey| to an ECMAScript value.
1180411811
1. Let |value| be the result of [=converted to an ECMAScript value|converting=] |idlValue| to an ECMAScript value.
1180511812
1. Let |array| be the result of performing [$ArrayCreate$](2).

0 commit comments

Comments
 (0)