LJC Lambdas Hackday
Zhong Yu
zhong.j.yu at gmail.com
Tue May 29 08:43:02 PDT 2012
> 2. Complex types are hard to read and understand. Scala already gets
> a really bad rep for this, and Java will as well if you’re not
> careful. Consider the function map’s signature:
>
> public static <T, U> Iterable<U> map(final Iterable<? extends T>
> iterable, final Mapper<? super T, ? extends U> mapper)
The only problem I see in this example is the dreadful syntax of
wildcard. The original syntax (Itreable<+T>, Mapper<-T,+U>) would be
much better. "? extends/super" does the exact opposite of helping
readability. Maybe it's just me, but every sight of "? extends/super"
sends my brain to a micro stroke.
And API users don't event want to read about variance; their code,
written out of instinct without thinking of variance, simply compiles
(thanks to API designers). Forcing API users to wade through "?
extends" and "? super" to get to the type they care about (T,U) is
unnecessary punishment.
Zhong Yu
More information about the lambda-dev
mailing list