-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Normative: WeakRef.prototype.constructor should be writable #3638
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
base: main
Are you sure you want to change the base?
Conversation
Test262 also tests that the property is writable: https://github.com/tc39/test262/blob/68a817d71341175e3cd1029c3b3905948b23ef28/test/built-ins/WeakRef/prototype/constructor.js#L27 |
This matches how all other `constructor` properties are defined and implementations also implement the property as writable.
02094f5
to
95ed47c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to remind myself what the default property descriptor was for these. From ECMAScript Standard Built-in Objects
Every other data property described in clauses 19 through 28 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
LGTM editorially but I've yet to confirm the claimed implementation reality. I also want to double check with the other editors that this wasn't done for a reason.
Not quite all. The
WeakRef.prototype does look like an odd man out though. |
Notably, all of those are "hidden intrinsics", only reachable from syntax, except for WeakRef. cc @erights |
WeakRef.prototype.constructor is definitely special; among other things it is normative optional (as per tc39/proposal-weakrefs#133). But I don't know if there was some reason it was made non-writable, especially given that it is configurable. |
I know why we made it normative optional. I don't remember anything about its writability one way or the other, but it may have just been following the precedent of those above. Yes, they are reachable from syntax and this is not. But I don't know why reachability-from-syntax should imply anything about the writability of those either. Does anyone have a way to easily find the notes from when any of these were discussed? |
Attn @kriskowal @gibson042 @mhofman |
This matches how all other
constructor
properties are defined and implementations also implement the property as writable.