getter and setter inheritance

Lars Hansen lhansen at adobe.com
Fri May 9 09:49:59 PDT 2008


> -----Original Message-----
> From: es4-discuss-bounces at mozilla.org 
> [mailto:es4-discuss-bounces at mozilla.org] On Behalf Of liorean
> Sent: 9. mai 2008 09:34
> To: es4-discuss at mozilla.org
> Subject: Re: getter and setter inheritance
> 
> 2008/5/9 Lars Hansen <lhansen at adobe.com>:
> > My view is that getters and setters introduce properties 
> and that whatever we do should be appropriate to that model.
> 
> That is pretty much my view as well.

See my more recent message for an elaboration of that, but I don't
think we disagree.

> Just a couple of questions that might need addressing, if it
> hasn't been dealt with already:
> - Can you have a property together with a getter and/or a setter?

Not in ES4, though you can use different namespaces of course:

  class C {
    function get x() private::x
    function set x(v) private::x = toInt32(v)
    private var x = 0
  }

> - If so:
>   * Is there any way to reach that property from inside the 
> getter/setter without ending up recurring into the getter/setter?
>   * Can a setter modify the property if there is a property 
> but no getter?
>   * Can a getter read the property if there is a property but 
> no setter?

The catchall mechanism has to deal with these issues and have a
way of asking for default behavior to be invoked.  I'll have more
to say about this next week.

--lars



More information about the Es4-discuss mailing list