W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: Figuring out easier readonly interfaces

From: Simon Pieters <simonp@opera.com>
Date: Fri, 18 Oct 2013 10:37:38 +0200
To: "Mark S. Miller" <erights@google.com>
Cc: "James Graham" <james@hoppipolla.co.uk>, "Domenic Denicola" <domenic@domenicdenicola.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <op.w44580tsidj3kv@simons-macbook-pro.local>
On Fri, 18 Oct 2013 04:23:24 +0200, Mark S. Miller <erights@google.com>  
wrote:

>> https://dvcs.w3.org/hg/csswg/**raw-file/748437d8a1dc/cssom-**
>> view/Overview.html#domrect<https://dvcs.w3.org/hg/csswg/raw-file/748437d8a1dc/cssom-view/Overview.html#domrect>
>>
>> or
>>
>> https://dvcs.w3.org/hg/csswg/**raw-file/3c529183812b/cssom-**
>> view/Overview.html#domrect<https://dvcs.w3.org/hg/csswg/raw-file/3c529183812b/cssom-view/Overview.html#domrect>
>>
>> A drawback here is that if one wants to check if an object is a "rect",
>> you need to do two instanceof checks.
>
>
> For the webidl at the first link, aren't you naming the common supertype
> AbstractRect? That would be fine with me.

Not really, they are equivalent in the JS binding. Note  
[NoInterfaceObject] and implements.

> For both, it seems like DOMRectAny is also a common supertype, specified  
> as
> a union type rather than by "implements".

No, a typedef isn't a supertype, it's just convenience for the spec  
itself. It's not reflected in the JS binding.

> I don't love the name but it is
> non-objectionable. So only the second design needs two instanceof checks?
> For the first, you can just "... instanceof AbstractRect"?

No, both need two instanceof checks. AbstractRect isn't visible to JS.

We could use a real common interface, but I recall objections against  
having a bazillion interfaces and stuff for a single "thing".

> Aren't you also missing a subtype for an immutable DOMRect?

No, it's intentionally omitted because nothing needs it yet.

-- 
Simon Pieters
Opera Software
Received on Friday, 18 October 2013 08:38:11 UTC

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