getter and setter inheritance

Mark S. Miller erights at google.com
Sun May 11 20:04:13 PDT 2008


On Sun, May 11, 2008 at 4:40 PM, Kris Zyp <kris at sitepen.com> wrote:
> [...] That being said, I would still favor the approach of treating
> getters/setters as a full slot, where inheritance doesn't go past
> half-definitions because that is behavior that is currently used on the web
> today.

Great!

> Also, the idea of making setters without getters illegal is interesting.
> However, while they may be rare, I think setters without getters has use
> cases. This seems like unnecessary arbitrary restriction to dissallow
> setters without getters. Furthermore, this is not the behavior of current
> browsers, there is no precedent in JavaScript implementations for preventing
> this combination. Is there other reasons for this restriction that I am not
> aware of?

Not really. I can live with write-only procedural properties. I don't
think it changes any of the other points.

When reading a write-only property, i.e., a procedural property with a
setter and no getter, one reads undefined, even in strict mode. Right?
So an absent getter is always equivalent to a getter of
"function(){return undefined;}"?

-- 
    Cheers,
    --MarkM



More information about the Es4-discuss mailing list