W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2015

Re: [geometry] Dictionary argument for DOMQuad constructor

From: Simon Pieters <simonp@opera.com>
Date: Thu, 26 Mar 2015 22:02:05 +0100
To: "Robert O'Callahan" <robert@ocallahan.org>
Cc: "public-fx@w3.org" <public-fx@w3.org>, "Domenic Denicola" <d@domenic.me>, "Boris Zbarsky" <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <op.xv4h1rx8idj3kv@simons-mbp>
On Thu, 26 Mar 2015 20:50:08 +0100, Robert O'Callahan  
<robert@ocallahan.org> wrote:

> On Thu, Mar 26, 2015 at 11:50 PM, Simon Pieters <simonp@opera.com> wrote:
>
>> On Wed, 25 Mar 2015 13:55:04 +0100, Domenic Denicola <d@domenic.me>  
>> wrote:
>>
>>  I think a better solution might be a single constructor (no overloads)
>>> plus static factory methods. So something like
>>>
>>>     [Constructor(optional DOMPointInit p1, ...)]
>>>     interface DOMQuad {
>>>         ...
>>>         static fromRect(optional DOMRectInit);
>>>         static fromQuad(optional DOMQuadInit);
>>>     }
>>>
>>
>> Thanks. This seems like a better API design and avoids the issues.
>> Particularly when dictionaries are involved.
>>
>> Is Mozilla OK with changing to something like this? Not just for DOMQuad
>> but for the rest as well.
>
>
> Right now we have implemented the DOMPointInit constructor and
> Constructor(DOMRectReadOnly rect). Is there any reason not to keep the
> latter?

It is useful to be able to use a straight JS object as a rect. I think it  
would be good for Web developers to consistently support dictionary types  
instead of supporting them in some places but require an object of the  
proper interface in other places.

If we introduce static methods to support dictionary types, it would be a  
bit of a wart to also support the constructor overload with  
DOMRectReadOnly. Reverting the spec to match what you implemented is still  
inconsistent wrt dictionary vs interface in different places.

On Thu, 26 Mar 2015 21:13:04 +0100, Robert O'Callahan  
<robert@ocallahan.org> wrote:

> And FWIW we implemented that because it's what the spec used to say:
> http://www.w3.org/TR/2014/WD-geometry-1-20140522/#DOMQuad

Yes. That's why I ask if you're OK with the proposed change. :-)

-- 
Simon Pieters
Opera Software
Received on Thursday, 26 March 2015 21:02:37 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 26 March 2015 21:02:37 UTC