Lambda's/Closures & Extension Methods in JDK 1.6

Brian Goetz brian.goetz at oracle.com
Wed Sep 29 09:46:25 PDT 2010


You should look at the work going on in Lambda surrounding "Virtual Extension 
Methods" as well as the work going on in JSR-292 on "interface injection."

On 9/29/2010 12:26 PM, Llewellyn Falco wrote:
> I don't think we are talking about different things.
> I'm not talking about a compiler based solution.
> I'm refereeing to my own object based solution.
> you can see it here:
> Extension Methods : http://bit.ly/ExtensionMethods
>
> the syntax looks like
> "abcde".use(StringUtils.class).removeVowels()
>
>
>
> On Wed, Sep 29, 2010 at 8:53 AM, Brian Goetz <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
>         As I mentioned, I'm currently using them without even changing the
>         compiler.
>         They work well, but I find the syntax a bit cumbersome. I haven't
>         found any
>         brittle class issues. I should mention that the syntax was cumbersome
>         enough
>         that I didn't use them for about a year, until I started using
>         lambdas. Now
>         they have become more essential.
>
>         Did you try out the solution?
>
>
>     A compiler-only solution fails on the following case:
>
>     interface Foo {
>       public extension void foo() default X.a();
>     }
>
>     interface Bar extends Foo {
>     }
>
>     class C implements Bar { }
>
>     // Compile the above classes, then recompile Bar with:
>
>     interface Bar extends Foo {
>       public extension void foo() default X.b();
>     }
>
>     // Re-run your program.  Now behavior of C is wrong; you call the wrong
>     default when C.foo() is called.
>
>



More information about the coin-dev mailing list