cjkent at hotmail.com
Wed Aug 8 04:19:55 PDT 2012
I agree with Stephen. Interfaces with defender methods provide enough trait-like features that developers (including me) will use them as traits. It doesn't make any difference whether or not the people on this list think it's a good idea.
I think my experience is fairly typical of corporate Java devs and I'm struggling to think of examples where the ability to evolve an interface would've been useful. But I've often wished for multiple inheritance of behaviour.
On 8 Aug 2012, at 11:56, "Stephen Colebourne" <scolebourne at joda.org> wrote:
> On 8 August 2012 11:37, Talden <talden at gmail.com> wrote:
>> On Wed, Aug 8, 2012 at 9:49 PM, Stephen Colebourne <scolebourne at joda.org> wrote:
>>> Where there is no doubt in my mind is that I will use traits (in
>>> whatever form they are provided) for far, far more than interface
>>> evolution when JDK8 is released.
>> This paragraph stood out to me. The wording is important.
> Let me reword then.
> A new feature is being added to JDK8 - default method implementations
> in interfaces.
> Some are trying to state that this should only be used for interface evolution.
> I am stating that I will use it for multiple-inheritance/trait-like
> behaviour, far, far more than interface evolution.
> More broadly, I'm saying that interface evolution is only occasionaly
> an issue I face. And yes, this new feature will be useful for
> interface evolution, but that won't be its prime use for me.
> Having established the above, it is clear to me that it would be far
> better to have a properly designed fuller implementation, than suffer
> from the hamstrung API designs we will see (like the "do" method
> prefix) without the fuller trait-like feature.
>> It seemed that what you were really saying was "...that I will use
>> interface default methods to implement traits far, far more...". I say
>> that because you cannot say that you will 'use traits' when they're
>> not on offer - you can only state an intent to use the offered
>> features in an unintended way.
> I'm advocating that the "unintended way"/"misuse" argument will be
> ignored, and this feature will get used far beyond the original
> intent. There is nothing I can see that Oracle can do to prevent that.
More information about the lambda-dev