New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module namespace @@iterator seems strange #710

Closed
domenic opened this Issue Oct 12, 2016 · 3 comments

Comments

Projects
None yet
5 participants
@domenic
Member

domenic commented Oct 12, 2016

There is no other object in JS whose iterableness expresses a list of its keys. It seems strange that for module namespace objects, we are expecting people to write

for (const x of moduleNamespace) {
  console.log(moduleNamespace[x]);
}

whereas for other JS objects, we are expecting people to write

for (const x of Object.keys(obj)) {
  console.log(obj[x]);
}

It makes more sense to me to require the latter pattern for all objects.

Is it appropriate to suggest removing the iterator at this stage?

@caridy

This comment has been minimized.

Show comment
Hide comment
@caridy

caridy Oct 12, 2016

Contributor

I totally agree! I remember we touched on this a while ago, and it is just weird. Maybe @allenwb knows better, but maybe this was just a leaking definition from the time of the loader.

Contributor

caridy commented Oct 12, 2016

I totally agree! I remember we touched on this a while ago, and it is just weird. Maybe @allenwb knows better, but maybe this was just a leaking definition from the time of the loader.

@littledan

This comment has been minimized.

Show comment
Hide comment
@littledan
Member

littledan commented Oct 18, 2016

ajklein added a commit to ajklein/ecma262 that referenced this issue Dec 6, 2016

Remove @@iterator from Module Namespace objects
Per consensus at the November 2016 meeting, Module Namespace exotic
objects no longer have an @@iterator method.

Also changes the [[Configurable]] property of the @@toStringTag
property to false, as per consensus in the same meeting (and
because it's impossible to reconfigure due to the exotic
methods of such objects).

This closes tc39#693 and tc39#710.

bterlson added a commit that referenced this issue Dec 20, 2016

Normative: Remove @@iterator from Module Namespace objects (#747)
Per consensus at the November 2016 meeting, Module Namespace exotic
objects no longer have an @@iterator method.

Also changes the [[Configurable]] property of the @@toStringTag
property to false, as per consensus in the same meeting (and
because it's impossible to reconfigure due to the exotic
methods of such objects).

This closes #693 and #710.
@ajklein

This comment has been minimized.

Show comment
Hide comment
@ajklein

ajklein Dec 29, 2016

Contributor

This should be closed, as @@iterator has been removed from the spec.

Contributor

ajklein commented Dec 29, 2016

This should be closed, as @@iterator has been removed from the spec.

@bterlson bterlson closed this Dec 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment