But Reinier had a "supersolution"? On Mon, Feb 23, 2009 at 1:37 AM, Edward <edward.ribe...@gmail.com> wrote:
> > Java closures discussion is dead end, quite that simple. There are two > opposite forces and no consensus on that issue in a foresseable > future.:-( I was eagerly hoping for new features like closures in Java > language, but any real evolution I've seen is being directed towards > the vm, tools, specs and alike. The big mammoth (aka JEE) is an > outstanding example of this. > > Maybe we can see closures in Java *someday*, but don't count on that. > It will be long after part of the community has adopted other > languages (Scala, Ruby, Clojure, etc) in addition to Java, and as a > desperate attempt to regain market position. > > /Edward > > > On 21 fev, 17:27, Casper Bang <casper.b...@gmail.com> wrote: > > +1. What you're really after though are mixins, not extension methods > > no? > > > > /Casper > > > > On 21 Feb., 17:25, Reinier Zwitserloot <reini...@gmail.com> 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? > > > > -- Viktor Klang Senior Systems Analyst --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---