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 14:38:58 +0200
To: "Dirk Schulze" <dschulze@adobe.com>, "Domenic Denicola" <domenic@domenicdenicola.com>
Cc: "robert@ocallahan.org" <robert@ocallahan.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <op.w30qq8ltidj3kv@simons-macbook-pro.local>
On Thu, 26 Sep 2013 14:15:47 +0200, Domenic Denicola  
<domenic@domenicdenicola.com> wrote:

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

AFAICT there would be two separate properties in JS.

http://dev.w3.org/2006/webapi/WebIDL/#es-attributes

However, roc pointed out that the inheritance idea is confusing since the  
mutable object would inherit from an interface that claims immutability.  
Having separate interfaces doesn't have that problem.

-- 
Simon Pieters
Opera Software
Received on Thursday, 26 September 2013 12:39:31 UTC

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