- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 26 Sep 2013 11:26:56 -0400
- To: public-script-coord@w3.org
On 9/26/13 5:33 AM, Cameron McCormack wrote: > Would it be too fancy to try to use inheritance to relate DOMRect and > DOMRectReadOnly? Web IDL already has this syntax: > > interface DOMRectReadOnly { > readonly attribute double x; > ...; > }; > > interface DOMRect : DOMRectReadOnly { > inherit attribute double x; > ... > }; > > which basically means to have the same behaviour for > DOMRect.prototype.x's getter as DOMRectReadOnly.prototype.x's. The big drawback from my pov is that this setup means you can't interpose your own getter on DOMRectReadOnly and have DOMRect pick it up.... I really wish ES allowed defining the inheritance directly in the language. As it is, maybe "inherit" should end up forwarding to the canonical parent proto's getter, instead of calling the same internal impl? It's hard to say which is more "idiomatic"; both are viable implementation strategies. -Boris
Received on Thursday, 26 September 2013 15:27:24 UTC