PROPOSAL: Static Methods in Interfaces (v1.1)

Neal Gafter neal at gafter.com
Tue Mar 17 23:14:59 PDT 2009


On Tue, Mar 17, 2009 at 10:57 PM, Marek Kozieł <develop4lasu at gmail.com> wrote:
> Bad sites:
> 1. You need know where the methods are and then you can use it.

Yes.  That's a good thing, because you don't get what you don't ask
for or don't want to know about.

> 2. What happen if some one write same method in inherited class and you will
> want use extended one?

Use the old syntax (invoke the method from its static utility class).

> 3. What happen if there will be two extension with same methods:
> Extension1{
>    void method1(...){...}
>    void method2(...){...}
> }
>
> Extension2{
>    void method1(...){...}
>    void method2(...){...}
> }
>
> ... and u want call Extension1.method1 and Extension2.method2

Then just call them.  You aren't required to use extension methods as
if they are members of the type they extend.

> 3. It's not clear if method is extension or it's in class for the one who
> read the code.

That's true; you'd have to look at the class documentation AND the
imports clause.

> I see it MS way solution: good for short projects.

I haven't heard that experience based on the MS solution.  On the
contrary, I've heard that it is very helpful for large scale projects.
 Can you point me to any writeup of this experience?



More information about the coin-dev mailing list