-
Notifications
You must be signed in to change notification settings - Fork 5
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
What is the difference between Type 2 and Type 3? #6
Comments
Type 2: class A extends Array {}
A.from([1,2,3]) // return type: A
.map(x => x + 1); // return type: A Type 3: class B extends Array { static [Symbol.species] = Array; }
B.from([1,2,3]) // return type: B
.map(x => x + 1); // return type: Array |
To add to what @rkirsling said:
|
It's hard for me to understand this distinction from the text in the explainer, since both II and III mention Ultimately, I think the difference between My understanding of the security issues in the past is, some come from invoking arbitrary user-defined code, and some come from manipulations on the object afterwards. I'm not sure how much we'd gain by just removing (By contrast, I think #1, which isn't one of the options mentioned in the current README, would address the second class of bugs around manipulating objects which are not actual instances of the superclass.) If we get rid of |
Not a typo, but I see the confusion. The explainer's language distinguishes this by saying "default values of
Yeah, I agree that from an implementation and a security POV the difference is superficial. The difference between Type II and Type III is the user-facing question: do users expect what class the instances that built-ins create to be programmable? But that difference isn't exactly the
True, I'll try to incorporate #1 into the explainer somehow as an alternative.
Yeah, I still think it'd be best to remove both |
They both read the same to me. Does Type 2 only allow the exact subclass, while Type 3 allows any subclass?
The text was updated successfully, but these errors were encountered: