Closed Bug 894637 Opened 11 years ago Closed 11 years ago

Map and WeakMap should try to initialize via "entries" method

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bbenvie, Unassigned)

References

(Blocks 1 open bug)

Details

In the most recent ES6 spec (July 2013 revision) Maps and WeakMaps initialized with an iterable should attempt to call its "entries" method first, and then fallback to the iterator symbol (or "iterator" in our case since we're not using the Symbol yet).

See spec sections 15.14.1 and 15.15.1.
(In reply to Brandon Benvie [:bbenvie] from comment #0)
> In the most recent ES6 spec (July 2013 revision) Maps and WeakMaps
> initialized with an iterable should attempt to call its "entries" method
> first, and then fallback to the iterator symbol (or "iterator" in our case
> since we're not using the Symbol yet).
> 
> See spec sections 15.14.1 and 15.15.1.

WeakMap? Or Set? There is no entries method of WeakMap ;)
(In reply to Rick Waldron from comment #1)
> WeakMap? Or Set? There is no entries method of WeakMap ;)

Sorry, the "its" there was unclear; that refers to the iterable passed to the constructor, not the initializing Map/WeakMap. But I think this bit of the spec has been changed recently to just use @@iterator, so this bug may be invalid anyway.
(In reply to Brandon Benvie [:bbenvie] from comment #2)
> (In reply to Rick Waldron from comment #1)
> > WeakMap? Or Set? There is no entries method of WeakMap ;)
> 
> Sorry, the "its" there was unclear; that refers to the iterable passed to
> the constructor, not the initializing Map/WeakMap. But I think this bit of
> the spec has been changed recently to just use @@iterator, so this bug may
> be invalid anyway.

Got it, thanks for clarifying
(In reply to Brandon Benvie [:bbenvie] from comment #2)

> Sorry, the "its" there was unclear; that refers to the iterable passed to
> the constructor, not the initializing Map/WeakMap. But I think this bit of
> the spec has been changed recently to just use @@iterator, so this bug may
> be invalid anyway.

According to https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-iterable-comparator you are right. So should we close this bug?
Flags: needinfo?(bbenvie)
Indeed.
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(bbenvie)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.