- From: Dirk Schulze <dschulze@adobe.com>
- Date: Thu, 26 Sep 2013 06:51:25 -0700
- To: Domenic Denicola <domenic@domenicdenicola.com>
- CC: Simon Pieters <simonp@opera.com>, "robert@ocallahan.org" <robert@ocallahan.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Sep 26, 2013, at 3:36 PM, "Domenic Denicola" <domenic@domenicdenicola.com> wrote: >> Hmm, then every method that can take both as argument, also must specify both every time. Beside that, you also need to implement each interface twice. One for the mutable case, on for the immutable. Means you have duplication all over the platform. That sound suboptimal. > > Shouldn't any interfaces that take these as arguments actually accept anything in the form { left, right, top, bottom } or { left, right, width, height }? No real JS API would force you to pass through a constructor when an object literal would do. > > Stated in terms of proto-JSIDL semantics (which admittedly are not a real thing yet), for arguments you would not use the DOMRect brand, but instead the ToRect conversion, which takes objects of the above two forms and returns a normalized version for your method's algorithm to operate on (or throws a TypeError if the incoming object does not match either of those two forms). > > DOMRect still has use as a return value, and DOMRect instances pass through ToRect just fine, but using DOMRect on the input side as well as for return values makes for very awkward APIs, of the type this mailing list is designed to help avoid. That is right for DOMPoint, not sure if we have an agreement to create a DOMRectLiteral or even a DOMMatrixLiteral. Greetings Dirk
Received on Thursday, 26 September 2013 13:52:15 UTC