Introduce Covariance/Contravariance at declaration site for Java 9 ?

Kevin Bourrillion kevinb at google.com
Thu Oct 18 12:25:09 PDT 2012


FTR, I agree fairly strongly with everything Dan says here.


On Thu, Oct 18, 2012 at 12:20 PM, Dan Smith <daniel.smith at oracle.com> wrote:

> I think it's a good idea, at least worth serious consideration.
>
> There would be no _requirement_ to design libraries in
> declaration-site-friendly ways, but the fact is we already have _lots_ of
> types that are inherently co-/contra- variant, and the "right" way to use
> those types is to always use a wildcard.  It turns into a mechanical
> transformation that obscures the code behind layers of wildcards and
> pointlessly punishes users if they mess up; it would sure be nice to remove
> that burden from clients of variant types.
>
> Anyway, I can say it's on the radar.  But maybe we will conclude it's a
> horrible idea; or maybe other things will take priority.
>
> —Dan
>
> On Oct 15, 2012, at 6:24 PM, Joshua Bloch <josh at bloch.us> wrote:
>
> > I believe that declaration site variance annotations are every bit as
> bad as use-site annotations.  They're bad in a different way--they force
> you to write idiosyncratic types because natural types don't lend
> themselves to fixed variance restrictions--but they're still bad. Providing
> both use and declaration site variance in one language is the worst of both
> worlds (unless you're trying to kill the language).
> >
> >     Josh
> >
> > On Mon, Oct 15, 2012 at 3:09 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> > I've just read the presentation of Stuart Marks at JavaOne [1],
> > all examples after slide 32, the first one that use lambdas are not
> written correctly
> > because all method signatures do not use wildcards.
> >
> > Brian, I know that we will not be able to introduce
> covariance/contravariance
> > at declaration site for Java 8, so the solution we will deliver will be
> far from perfect
> > because nobody understand wildcards.
> > Is there a way to free Dan and Maurizio  enough time to investigate if
> > covariance/contravariance can be added to Java 9.
> >
> > Rémi
> > [1]
> https://stuartmarks.wordpress.com/2012/10/07/javaone-2012-jump-starting-lambda-programming/
> >
> >
>
>


-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20121018/74b564cc/attachment.html 


More information about the lambda-libs-spec-experts mailing list