-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ToObject should specify what realm it uses #1104
Comments
@domenic would you consider it sufficiently explicit if the table said |
Hmm. I think probably we should close this. I'm not sure why I filed this issue to pick on this one particular instance of "a new X object" in the spec as not being specific enough. But in general this is a widespread "problem" in the spec, which is probably not worth fixing piecemeal, and likely not worth fixing at all. If there is a solution, it'd be more general; something like defining "new X object" (similar to https://heycam.github.io/webidl/#internally-create-a-new-object-implementing-the-interface), and stating that by default the realm used is always the current realm. But that's a big project with dubious payoff, so I'd be fine closing this over-specific issue. |
All operations that don't explicitly reference a specific realm operate using the current realm. That's kind of implicit in the concept of a "current realm" but if you wanted to explicitly state it somewhere perhaps the into to Clause 7 would be a place to put it. Note sure that mentioning %Boolean% etc. in ToObject would be appropriate as the intent isn't to actually call the constructor function. If you want to be more explicit then what is already in ToObject (a I'm not really sure that is necessary you should probably define Boolean, Number, and Symbol analogs to StringCreate ( value, prototype ) and use them in ToObject. |
It sounds like there’s a few possible ways forward here:
2 can happen whether 3/4 does or not, of course. I don’t feel too strongly about the direction; but i do think it’s worth doing something especially if the implicitness here is a pervasive occurrence. cc @zenparsing |
Note that the realm is only only used for choosing the value of the prototype object so passing a prototype as an argument to CreateXXX functions is sufficient. But, I ssuggest just doing #2 so you have something to point at if this question is asked again. |
https://tc39.github.io/ecma262/#sec-toobject
Which
Boolean
constructor or%BooleanPrototype%
should this use? The spec definitely means the current Realm, but it'd be nice to be explicit.The text was updated successfully, but these errors were encountered: