-
Notifications
You must be signed in to change notification settings - Fork 67
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
Should we really include all the intrinsics? #48
Comments
The membership is probably related to #22 as well, and it is definitely an area that requires some brainstorming. As for the second part, I will let @erights to comment, but in all other cases, those prototypes are exposed to user-land somehow (e.g.: via prototype chain when constructing an iterator), and even though those are not accesible via a global, the implementation must reify them.
They are very different, and not all the intrinsics are available via |
The owner of the realm can access stdlib.Array.prototype before he gives a reference to it to anyone else. |
Almost, it is |
Are there any intrinsics that aren't somehow accessible from the global object at realm creation time? If so, which are they? |
You can easily get access to %ArrayIteratorPrototype% using similar mechanisms. Again, my point is that we should refocus on use cases. So far I've seen you implicitly express the use cases of:
My claim is that neither of these use cases is very compelling, and I'd like to see some substantive use-case focused discussion to address that point and justify the inclusion of intrinsics in the spec. |
Do we really need to expose the Exposing the intrinsics can easily cause identity discontinuities: class FakeWindow extends Realm {
init() {
super.init();
let global = this.global;
global.document = new FakeDocument(...);
}
}
const r = new FakeWindow();
r.evaluate("document instanceof Object"); // false For most use cases, we need to decide if we create:
Then, all patching can be done using class FakeWindow extends Realm {
constructor() {
super();
this.evaluate(documentShimSource);
}
}
const r = new FakeWindow();
r.evaluate("document instanceof Object"); // true |
As we note at #52 (comment) and elsewhere, we should drop the intrinsics api from the realms proposal completely. It is a dangerous way to customize a realm. |
It seems like intrinsics is still part of this API, see https://github.com/tc39/proposal-realms/blob/master/spec/index.emu#L110 . Is there any plan to revisit this issue? Seems important to come to a resolution on one way or another before Stage 3. (I like the conclusion reached earlier in this thread to remove the API.) |
* Normative: Remove intrinsics() method from spec Closes #48 * Remove intrinsics() method from README
There are a couple interesting problems with the current approach of copying all the intrinsics from table 7:
Neither of these is a showstopper, but they do imply to me that maybe copying table 7 is not the right move. Instead perhaps we should be looking for what the actual use cases for the intrinsics are and trying to craft something based on that. In particular I'm skeptical that intrinsics provides any value over stdlib.
The text was updated successfully, but these errors were encountered: