+1. What you're really after though are mixins, not extension methods
no?

/Casper

On 21 Feb., 17:25, Reinier Zwitserloot <[email protected]> wrote:
> java7 isn't going to have closures, but I don't think the topic has
> been dropped entirely; just delayed, right?
>
> Via Neil Gafter's twitter stream, the simple idea that you need to
> entirely retrofit the Collections API (with methods like 'filter',
> 'map', 'map.foreach' and other functionally inspired methods) and also
> parts of the file API (with methods like 'readLines', 'doWith',
> etcetera).
>
> Unless of course, you add extension methods. The ability to declare in
> an interface a method along with a default implementation. There's no
> issues with multiple inheritance - if that ever happens (one class
> gets 2 different default implementations by 2 different interface
> chains), then the rule is simple: Don't allow compilation, or even
> loading of, the class. Instead, the java file needs to be explicit (by
> implementing the method itself. They can refer to any default
> implementation by full name in the method body). Then it'll compile
> and run fine.
>
> Given the sheer amount of work you'd have to do re-engineering the
> java API, breaking backwards compatibility, or adding extension
> methods, is really the only way.
>
> So, given that closures are likely coming in java8, wouldn't it be
> nice to add the relatively low-impact extension method system right
> now?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to