why no function types?
Neal Gafter
neal at gafter.com
Thu Mar 8 08:59:05 PST 2012
Don't those same limitations apply to function types written in the less
convenient *Mapper<? super A, ? extends B>* style?
On Wed, Mar 7, 2012 at 3:13 PM, maurizio cimadamore <
maurizio.cimadamore at oracle.com> wrote:
> Hi
> Long story short: since function types will probably be implemented as a
> generic type in the compiler generated code (i.e. something like
> Function<A1, A2, ... An, R, E1, E2 ... Em>), function types will be
> subject to the same limitations as generic types because of
> type-erasure; the two most common issues are:
>
> *) cannot write two overloaded methods each one accepting a different
> function type
> *) cannot create an array of function types
>
> Maurizio
>
> On 07-Mar-12 9:48 PM, Antoras wrote:
> > In the archive of the mailing list I found a topic which answers why
> > there are no function types [1].
> >
> > But I don't really understand the reason mentioned there (something
> > about erased function types after type erasure). Therefore I have to ask
> > again. Can someone explain me what happens when we write something like
> >
> > return_value map((A -> B) f);
> >
> > instead of
> >
> > return_value map(Mapper<A, B> f);
> >
> > I thought the first one could easily translated to the second one.
> >
> > Thanks in advance
> >
> >
> > [1]:
> >
> http://mail.openjdk.java.net/pipermail/lambda-dev/2011-December/004326.html
> >
>
>
>
More information about the lambda-dev
mailing list