Closed lpardosixtosMs closed 5 months ago
Yes, this is the intended behavior, it should work like any other public element in most aspects, so redeclarations are allowed and overwrite the previous declaration fully. This also prevents something like a subclass somehow colliding with a parent class.
Thanks for the quick response!
I'm implementing the proposal in V8 and I'd like to clarify if public auto-accessors can be redeclared.
Step 5 of the second part of this section of the draft spec creates a new Private Name whose description is the concatenation of the field's readable name and the "accessor storage" string. Since this is a new Private Name and not one taken from the private env names list, I conclude that it wouldn't collide with other private names when calling
PrivateFieldAdd
on it; and as a consequence, the following snippet is valid JavaScript:Is this the intended behavior?