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

Re: How to specify an object that can be mutable or immutable

From: Simon Pieters <simonp@opera.com>
Date: Thu, 26 Sep 2013 15:24:21 +0200
To: "Dirk Schulze" <dschulze@adobe.com>
Cc: "Domenic Denicola" <domenic@domenicdenicola.com>, "robert@ocallahan.org" <robert@ocallahan.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <op.w30suvg2idj3kv@simons-macbook-pro.local>
On Thu, 26 Sep 2013 15:11:52 +0200, Dirk Schulze <dschulze@adobe.com>  

> 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.

Not everything needs to support both immutable and mutable objects, but  
otherwise, yeah.

We can solve the "have to specify both every time" by defining a typedef,  

typedef (DOMRect or DOMRectImmutable) DOMRectAny;

> That sound suboptimal.

I think it is the least bad option suggested so far.

Simon Pieters
Opera Software
Received on Thursday, 26 September 2013 13:24:59 UTC

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