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:44:34 +0000
To: Simon Pieters <simonp@opera.com>
CC: Dirk Schulze <dschulze@adobe.com>, "robert@ocallahan.org" <robert@ocallahan.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <1E7EE929-63A5-4646-9AE1-267015B716F2@domenicdenicola.com>
> On Sep 26, 2013, at 8:39, "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.

Right. More worryingly, what would

Object.getOwnPropertyDescriptor(MutableRect.prototype, "left").set.call(immutableRectInstance, 5)

Received on Thursday, 26 September 2013 12:45:12 UTC

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