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

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