Open domenic opened 6 years ago
@domenic would you consider it sufficiently explicit if the table said return a new %Boolean% object
? if not, do you have a suggestion for text? I'm happy to make the PR to update all the similar cases in that section.
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.
Explicitly define the phrase “a new X object” ...
Note that #1453 and #1460 have a lot to do with the phrase "a newly created [X] object", so we'd probably want efforts to co-ordinated.
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.