inheriting statics

Peter Hall peterjoel at gmail.com
Mon Jan 8 09:05:14 PST 2007


> But it also would make refactoring easier if I could move a static
> property to a different superclass and not have to update all uses of
> it in subclasses.
>

So there's a use-case for inheriting static members. Not a hugely
impressive one, but a use-case nonetheless.


The case for inheriting statics:

1. static members are inherited in Java and C# (I think)
2. It won't break existing code because that code either would be in
error or else would have  overridden the member.
3. easier refactoring, if you move the member within an inheritance chain.

The case against inheriting statics:

1. Static members are not inherited in ES3 or JS1
2. It's a change to what's in the spec already



One thing that I do feel strongly about is the scoping of super-class
statics in sub-classes. I find that behaviour confusing, as it feels a
bit like inheritence, but it isn't. What is the value of that
behaviour?

Peter



More information about the Es4-discuss mailing list