This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28979 - iterable declaration and forEach ECMAScript binding issues
Summary: iterable declaration and forEach ECMAScript binding issues
Status: NEW
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-20 23:20 UTC by David Dorwin
Modified: 2016-06-02 19:22 UTC (History)
2 users (show)

See Also:


Attachments

Description David Dorwin 2015-07-20 23:20:40 UTC
The following issues are related to the iterable declaration, especially the associated forEach ECMAScript binding and other occurrences of "forEach" in the spec. (This is somewhat related to bug 28978.)


In the forEach ECMAScript binding section's "If the interface has an iterable declaration..." algorithm [1]:

1. In step 4.1 , `kValue` is assigned but never used. Is `value` in 4.2 supposed to be `kValue`?

2. It is not immediately obvious that the value in the "If the interface has an iterable declaration..." algorithm is a pair "If two type parameters are given" to the iterable declaration. Perhaps a note and/or reference back to [2] and [3] would be helpful.

3. Regarding "If the interface has an iterable declaration, then the Function must have the same behavior as one that would exist assuming the interface had this operation instead of the iterable declaration:"
 a. What does the following text mean? Does it mean forEach’s behavior must be the same as if forEach was explicitly specified on the interface?
 b. The text does not seem to lead into the IDL that follows it. Perhaps the text above should be followed by something like "It has the following IDL:"


In the iterable declaration section [4]:

4. Should the first Note include "forEach" like the one in the maplike [5] and setlike declaration sections? [1] implies it is present for the same reasons.

5. Regarding the "In the ECMAScript language binding" notes, the iterator declaration one refers to "properties" while the maplike and setlike declarations refer to "methods." Should these be consistent?

6. Should "key-type" and "value-type" instead be something like "value1-type" and "value2-type"? The current names imply that one is a key and the other is a value, but they are really just a pair of values with no meaning implied by the ordering. Also, the naming is misleading because the keys() and values() methods in the ECMAScript language binding don’t do what the type names imply. (keys() returns an iterator over the indexes and values() returns an iterator over the pair of values.

[1] https://heycam.github.io/webidl/#es-forEach
[2] https://heycam.github.io/webidl/#dfn-value-iterator
[3] https://heycam.github.io/webidl/#dfn-pair-iterator
[4] https://heycam.github.io/webidl/#dfn-iterable-declaration
[5] https://heycam.github.io/webidl/#dfn-maplike-declaration
Comment 1 David Dorwin 2016-06-02 19:22:33 UTC
#4 appears to have been addressed. However, I believe `forEach` also needs to be added to the "Interfaces with iterable declarations must not have any interface members named..." sentence.