Do we really need the [[HasOwnProperty]] internal method and hasOwn trap

Brendan Eich brendan at mozilla.org
Wed Nov 14 02:34:29 PST 2012


Tom Van Cutsem wrote:
> At its core, this "footgun" is not specific to Javascript proxies: 
> it's an old problem in OO frameworks in general, whose documentation 
> may state: "if you subclass class C, and you override method "foo", 
> make sure you also override method "bar" consistently!". I'm sure 
> you've had way more practical experience with exactly this issue in 
> developing OO frameworks than I ever have :-)

Agreed. Some OO languages preclude super calls except to the same-named 
method as the one making the call, because they want all peer method 
calls to be virtual in the C++ sense. This goes too far in my view, 
though. Sometimes when calling a super-method you need to call a related 
super-peer-method. ES6 classes with super allow this.

There's no silver bullet for this footgun ;-).

/be


More information about the es-discuss mailing list