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

Why not delegate to this.constructor #9

Open
syg opened this issue May 22, 2020 · 1 comment
Open

Why not delegate to this.constructor #9

syg opened this issue May 22, 2020 · 1 comment

Comments

@syg
Copy link
Collaborator

syg commented May 22, 2020

To support Type II but not Type III, one obvious thing is to delegate to this.constructor.

I'd like to capture here that delegating to this.constructor is almost definitely not web compatible. Two data points:

  1. Microsoft tried to do this in the ES6 era and had to unship due to breakage. Would be great if someone could dig up the history here...

  2. There is a V8 use counter that counts modifications to .constructor of Arrays instances: https://chromestatus.com/metrics/feature/timeline/popularity/1394. That is an astonishing number of hits. I took a look at the top URL below, https://articlewipe.com. It's doing some kind of mix-in pattern where the .constructor is overridden. Crucially, that overridden .constructor[@@species] is undefined.

@syg
Copy link
Collaborator Author

syg commented Jun 3, 2020

@rwaldron also found this gem: https://github.com/tc39/notes/blob/master/meetings/2014-11/nov-18.md#46-zepto-broken-by-new-thisconstruct-usage-in-some-arrayprototype-methods

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

No branches or pull requests

1 participant