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

Add array grouping proposal #959

Merged
merged 4 commits into from Jul 29, 2021
Merged

Add array grouping proposal #959

merged 4 commits into from Jul 29, 2021

Conversation

zloirock
Copy link
Owner

@zloirock
Copy link
Owner Author

@jridgewell could you review it?

key = toPropertyKey(boundFunction(value, index, O));
// in some IE10 builds, `hasOwnProperty` returns incorrect result on integer keys
// but since it's a `null` prototype object, we can safely use `in`
if (key in target) push.call(target[key], value);

Choose a reason for hiding this comment

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

Nit: I switched a List type in the current spec, but I don't know how you implement list (it may just be a normal array?) But I think this exposes set operations in an incorrect order?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Lists are unobservable, so it's optimized for direct adding plain arrays to the null prototype object. If it's a custom array constructor or a typed array, they are created on a second loop pass and all observable operations evaluated in the correct order. The only observable difference with the current spec draft is an optimization of getting @@species constructor.

Copy link
Owner Author

@zloirock zloirock Jul 28, 2021

Choose a reason for hiding this comment

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

Sure, it's possible to define setters on Array.prototype or Object.prototype and observe it, but I think that it's an acceptable limitation. This is a limitation of all polyfills of features that use List that I know. It's possible to use arrays with null prototype or objects with null prototype, but I don't think that it's worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants