[Bug 12845] Disallow shadowing attributes

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12845

--- Comment #22 from Boris Zbarsky <bzbarsky@mit.edu> 2011-06-08 05:13:25 UTC ---
> you may expediently make the immutable version a sublass of the mutable version
> and over-ride all the mutation method to throw an error

That's not a workable solution for a web spec, because you can explicitly call
the "superclass" methods on the "subclass" instance (just grab them off the
higher-up-the-chain proto and use .call()).

> Adding write behavior is a specialization which is valid subtyping behavior.

I agree; I would be quite happy with explicit WebIDL syntax for this, as I
said.

> The second issue is how does this map to JS

That's a solvable problem; it doesn't matter to me that much how exactly we
solve it.

> The problem is with *incompatible* behaviour, right? 

_A_ problem is when two prototypes on the proto chain of an element, say, both
define a property and the two property getters do different things when called
on that element.  In particular it breaks grabbing a property off the higher-up
prototype and then applying its getter to all things that have that proto on
the proto chain... unless that operation somehow makes sense for this element
which has some other getter definition lower down on its proto chain.

I'm not sure I can think of an example of "different but compatible" behavior
that doesn't run into that problem.  Can you?

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Wednesday, 8 June 2011 05:13:28 UTC