Re: Figuring out easier readonly interfaces

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