List of all default methods

Jochen Theodorou blackdrag at gmx.org
Thu Nov 21 23:14:49 PST 2013


Am 21.11.2013 22:49, schrieb Brian Goetz:
>>> to produce a new sorted stream.  To avoid making things more confusing,
>>> we followed the guideline of adding in-place mutative methods to the
>>> concrete collections, and adding functional / lazy methods to Stream,
>>> rather than mixing.
>>
>> yes, only the problem is, that if we follow that rationale then we have
>> to remove dozens of our additions plus, the non-mutating versions would
>> not be available on a jvm before 8. Sadly we cannot strictly follow that
>
> Well, you have to decide what is best for *your* users.

This is no easy decision for us.

>>> As a general rule, adding stuff to Iterable is probably going to cause
>>> ongoing pain.  Use with care.
>>
>> Iterable, List, Collection, Map, CharSequence, Enumeration, Set,
>> SortedSet, SortedMap, Iterable
>
> Its a spectrum.  Adding methods involves reasoning about the probability
> of collision, and whether the weighted downside of collision is
> outweighed by the upside of the new functionality.

As you pointed out, the game changed. Before the classes almost did not 
change. With Java8 this is different.

> The more widely
> implemented an interface is (Iterable more so than List, List much more
> so than BeanContextServiceProvider), the more likely collision is just
> on a quantitative basis.  The more *abstract* it is, the more likely
> you'll have semantic conflicts.  Both suggest Iterable is about the
> worst interface to choose to "enhance".  (This is why we didn't add
> .stream() to Iterable; we forsaw semantic conflicts.)

We even have methods on Object. More far reaching than that is impossible ;)

> In any case, now that we're in the business of evolving interfaces as
> well as classes, I think you can expect some additional conflicts in the
> future.  Not necessarily too many, as we try to have restraint, but its
> going to happen.  Seems it happened once or twice in 8.  It might happen
> a few more times in 9.  You'll just need a plan for dealing with it.

yes,we are discussing about that.

bye Jochen

-- 
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org



More information about the lambda-dev mailing list