W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2014

Re: Exposing constructors of readonly interfaces to web authors

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 30 Jun 2014 15:12:56 -0700
Message-ID: <CAAWBYDAQ2nFfWq0izq6ZpC7BTusOmhHWYRZBhQ=+jU=ZO_B70A@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Mon, Jun 30, 2014 at 8:11 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 6/29/14, 10:55 PM, Robert O'Callahan wrote:
>> Are you saying we cannot have a WebIDL interface (DOMRectReadOnly)
>> representing a "common base class" for DOMQuad.bounds rectangles and
>> mutable DOMRects, because there are separate implementations with
>> different internal state?
> You can, but it takes some gyrations: effectively defining some sort of
> virtual hooks on the parent class and implementing them in the subclasses.
> The main benefit would be that scripts would have a one-stop place to hook
> getters on all rectangles by doing that on DOMRectReadOnly.prototype, but
> it's not terribly clear to me how useful that is.

Well, it lets people do precisely what RoC was imagining:

> It's easy to imagine extending DOMRectReadOnly with more functionality common to the subclasses, e.g. area(), contains(point), intersects(rect).

Received on Monday, 30 June 2014 22:13:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC