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

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