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: Domenic Denicola <domenic@domenicdenicola.com>
Date: Thu, 26 Sep 2013 12:15:47 +0000
To: Dirk Schulze <dschulze@adobe.com>
CC: "robert@ocallahan.org" <robert@ocallahan.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <D7D498D1-9162-41CB-A251-102672901E66@domenicdenicola.com>
Can somebody spell out how this proposed inheritance hierarchy works in actual ECMAScript, not WebIDL? I cannot see how it would work at all. A .js file containing some code that we can actually execute would make the most sense.

For example, if readonly is taken to mean non-writable non-configurable data properties, then you cannot reconfigure them to be writable in a subclass constructor. Or if it's meant to be getters only, touching an underlying backing store, then you should be able to bypass that protection by using the subclass setter applied to a superclass instance.

I am very concerned that the design thinking here is not taking place at the level of the language in which these constructs manifest.

> On Sep 26, 2013, at 8:10, "Dirk Schulze" <dschulze@adobe.com> wrote:
> 
> 
>> On Sep 26, 2013, at 1:13 PM, Robert O'Callahan <robert@ocallahan.org> wrote:
>> 
>> Immutability and read-only are different. An immutable object is one that is guaranteed to not change. In your case, a DOMRectReadOnly can change --- if it's actually a DOMRect. You just can't change it through the DOMRectReadOnly interface.
> 
> I got that. I just wonder if everyone does.
> 
> Since you probably don't modify the object passed as argument, you don't just want to allow DOMRect. So you use DOMRectImmutable (or DOMRectReadOnly), and this potentially could confuse people reading the WebIDL definition. However, this is a minor issue. I have nothing against the proposed inheriting structure for all the proposed geometries.
> 
> Greetings,
> Dirk
> 
>> 
>> This would be more clear if we called it DOMRectImmutable; it would be odd to have DOMRect extend DOMRectImmutable, because a DOMRect isn't immutable.
>> 
>> Rob
>> -- 
>> Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr, 'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp  waanndt  wyeonut  thoo mken.o w  
> 
> 
> 
Received on Thursday, 26 September 2013 12:16:21 UTC

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