Skip to content
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

Normative: make EnumerableOwnPropertyNames ordered #1793

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Nov 23, 2019

Related to proposal-for-in-order. Added as a separate PR because this change wasn't technically in scope during the process for that proposal. Thanks to @domenic for bringing this to my attention.

EnumerableOwnPropertyNames is used by Object.keys, Object.values, Object.entries, JSON.parse, and JSON.stringify.

Removing this line has the effect of requiring those to be ordered the same way as Reflect.ownKeys, which is fully specified, rather than for-in, which is only partially specified.

I have not been able to find cases where implementations order any of the APIs which use EnumerableOwnPropertyNames differently than they would Reflect.ownKeys, even in the presence of exotic objects and accessors which modify the object being iterated. So removing this line should not have any effects on the implementations I have on hand.

I want to make this change for two reasons:

  1. It removes a case where implementations are permitted to differ, and
  2. This line is incredibly confusing anyway, since it is impossible for an implementation to know how the "the Iterator that would be returned if the EnumerateObjectProperties internal method were invoked with O" would behave without actually invoking it, which can have arbitrary other side effects.

@bakkot bakkot added the needs consensus This needs committee consensus before it can be eligible to be merged. label Nov 23, 2019
Copy link
Member

@devsnek devsnek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begone evil prose

@ljharb ljharb requested review from syg, ljharb and a team November 27, 2019 22:17
@bakkot bakkot added has consensus This has committee consensus. and removed needs consensus This needs committee consensus before it can be eligible to be merged. labels Dec 3, 2019
@ljharb ljharb added the normative change Affects behavior required to correctly evaluate some ECMAScript source text label Dec 12, 2019
@ljharb ljharb merged commit ecb4178 into master Dec 12, 2019
@ljharb ljharb deleted the other-orders branch December 12, 2019 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has consensus This has committee consensus. normative change Affects behavior required to correctly evaluate some ECMAScript source text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants