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: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 26 Sep 2013 19:33:58 +1000
Message-ID: <5243FF86.2030801@mcc.id.au>
To: Simon Pieters <simonp@opera.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Simon Pieters wrote:
> Boris Zbarsky suggested it might be better to have two separate
> interfaces, with the mutable interface has settable attributes and the
> immutable interface has readonly attributes. [3]

Would it be too fancy to try to use inheritance to relate DOMRect and 
DOMRectReadOnly?  Web IDL already has this syntax:

   interface DOMRectReadOnly {
     readonly attribute double x;
     ...;
   };

   interface DOMRect : DOMRectReadOnly {
     inherit attribute double x;
     ...
   };

which basically means to have the same behaviour for 
DOMRect.prototype.x's getter as DOMRectReadOnly.prototype.x's.
Received on Thursday, 26 September 2013 09:34:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC