Virtual extension methods -- a strawman design
opinali at gmail.com
Sat May 15 12:06:03 PDT 2010
2010/5/15 Brian Goetz <brian.goetz at oracle.com>
> > Could you not add closures first and save the library changes for a
> > future update? The problem of retro-fitting the core API's does make
> > sense in terms of time frame but it's kind of now or never (or a few
> > years from now) in terms of having another opportunity to add them
> > without another new major version number isn't it?
> Yes, and it is quite possible we may end up doing just that.
I understand that the development of new APIs takes some time to design and
implement, so leaving that for SE8 would be acceptable as a tradeoff for not
missing lambdas at all or delaying SE7 further again. But I think at least
the adaptation of existing APIs should be a no-brainer? Even if this amounts
to only a handful of methods (like Collections.*), these are very critical
APIs that tend to be used a lot because collections in general are pervasive
in modern Java code. So we can allow application code to make a big step
forward, even with a small and conservative first step of API retro-fitting.
Like Mark said, "there's not a moment to lose" :) but I say that in the
context of the Java language's window of opportunity to remain... well,
attractive. Lambdas are already very late, even if JDK 7 ships tomorrow and
with state of the art lambdas including full API support. Pushing a
significant part of that to JDK 8 will be almost as bad as just skipping JDK
7 and having lambdas only in JDK 8 (or never at all). The Java platform
blurs the line between the Java language and its core libs (in the sense
that the language has no good extensibility mechanism and no built-in
support for concepts that are handled at the language level in some other
languages - so we rely a lot on core libs); so if SE7 only does the language
part, this will create serious fragmentation when we have the library
support later. We'd have two Java-with-lambdas variants, v7+ and v8+, and
that will suck in the v7->v8 transition period.
More information about the lambda-dev