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: Dirk Schulze <dschulze@adobe.com>
Date: Thu, 26 Sep 2013 06:11:52 -0700
To: Simon Pieters <simonp@opera.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: <496C751A-1278-48C2-84A2-8747AD3AC320@adobe.com>

Sent from my iPhone

> On Sep 26, 2013, at 2:39 PM, "Simon Pieters" <simonp@opera.com> wrote:
> 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.

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.


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

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