Virtual extension methods -- a strawman design
Rémi Forax
forax at univ-mlv.fr
Mon May 17 07:14:06 PDT 2010
Le 17/05/2010 15:58, Brian Goetz a écrit :
>> It is the year 2003. Sun is planning JDK 5. Due to many complaints of
>> Java programmers, Sun decides that a 'sort' method was needed in
>> java.util.List. They introduce a new
>>
>> interface List2 extends List {
>> public void sort(Comparator<? super E> comparator);
>> }
>>
>> and have all JDK List-classes implement List2 instead of only List.
>> They encourage the use of List2 in the API Doc.
>>
>> There would have been no compatibility issues at all. Programmers
>> would have adopted List2 whenenver they were writing new code.
>>
> And in user code, people would have inserted casts to List2 whenever they
> encountered a List, sometimes with an instanceof check first, sometimes
> without. That would not be good for the readability or maintainability of
> Java code.
>
Eclipse developers do something similar.
I was not happy when I tried to understand ITextViewer6:
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/text/ITextViewerExtension6.html
I am not a big fan of having to understand all the history of
an API before being able to use it. A friend of mine calls that:
archeological programming.
Rémi
More information about the lambda-dev
mailing list