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

RESOLVED INVALID

Status

()

defect
RESOLVED INVALID
6 years ago
6 years ago

People

(Reporter: bbenvie, Unassigned)

Tracking

(Blocks 1 bug)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
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 ;)
(Reporter)

Comment 2

6 years ago
(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)
(Reporter)

Comment 5

6 years ago
Indeed.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Flags: needinfo?(bbenvie)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.