mcnepp02 at googlemail.com
Tue Mar 30 23:17:23 PDT 2010
On March 11th I've made a likewise remark:
> Of course, if you intend to make lambda creation special with regards
> to automatic instance caching by the compiler, using 'new' is not a
> good idea. OTOH, is this really necessary?
> I have confidence that the capable library developer will identify
> stateless, non-capturing lambdas herself and provide factories for
> them or store them in static fields.
See the reply to my posting by Alex Blewitt from the same day:
"This is essential, yes. The majority of 'capable library developers'
may not, but the majority of Java developers using lambdas for the
first time may well do so. You'd like the compiler to do that for
2010/3/30 Howard Lovatt <howard.lovatt at gmail.com>:
> This is a two way argument, you could equally say can you demonstrate that
> the *compiler* can optimize my point 4 correctly. I am not suggesting that
> the JVM must optimize the creation away, just that it optionally can. If you
> are clear were the object is potentially created then the programmer can
> always do the optimization (just like the programmer already does for normal
> objects and is reminded to do so by the new keyword).
More information about the lambda-dev