Lightweight interfaces instead of function types

Neal Gafter neal at gafter.com
Fri Feb 19 09:47:09 PST 2010


On Fri, Feb 19, 2010 at 9:28 AM, Stephen Colebourne
<scolebourne at joda.org> wrote:
> By comparison, SAM interfaces have no such difficulties. You can hold
> an array of SAM interfaces safely today. If the SAM interface is
> generified, then there may be some associated warnings, but developers
> are familiar with those, and the effects on the type system are known.

Today:

Tmp.java:5: [error] generic array creation
        Callable<String>[] array = new Callable<String>[10];
                                   ^

This is a hard error, not a warning.

I have problems with your new reference conversions among interface
types that are not subtypes of each other.  They have all of the same
problems as the lambda conversion that Josh and I are complaining
about, and more.

Fleshing out your proposal and its implications would likely show it
to be more complex than the entire lambda proposal today.

Cheers,
Neal


More information about the lambda-dev mailing list