W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: JSIDL ideas for read only (Was: RE: Figuring out easier readonly interfaces)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 2 Oct 2013 18:09:29 -0700
Message-ID: <CAAWBYDAqoSHFR4ZwpJTfw6i0TxZia1_JOFpMhKe+QCe0p7Emtw@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Wed, Oct 2, 2013 at 5:14 PM, Domenic Denicola
<domenic@domenicdenicola.com> wrote:
> Forking threads since I took this on a tangent...
>
> My preferred solution to the readonly "problem," in the pie-in-the-sky JSIDL future, would look something like this:
>
> ```jsidl
> class Point {
>   get number x
>   get number y
>
>   get number length
> }
>
> class MutablePoint extends Point {
>    set x(ToNumber)
>    set y(ToNumber)
> }
> ```
>
> Here the setters in MutablePoint do a brand check (similar to that at [1]), preventing you from applying them to Point.

This is precisely the "two interfaces" problem, though.  If I want to
extend Point in the future, I need to remember to put a getter on
Point and a setter on MutablePoint.  That's a maintenance hazard I was
trying to avoid.

~TJ
Received on Thursday, 3 October 2013 01:10:20 UTC

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