JEP proposed to target JDK 11: 323: Local-Variable Syntax for Lambda Parameters

Jonathan Bluett-Duncan jbluettduncan at gmail.com
Fri Jan 26 14:02:52 UTC 2018


Hi Andrew,

I admit I'm a bit lost. I struggle to see how the following:

Function<Integer, Integer> function = (@Nullable x) -> (x == null) ? 0 : x
+ 1;

would be any better than:

Function<@Nullable Integer, @Nonnull Integer> function = x -> (x == null) ?
0 : x + 1;

or even just the following (if we make the reasonable assumption that
everything is non-null by default):

Function<@Nullable Integer, Integer> function = x -> (x == null) ? 0 : x +
1;

Is there something I'm missing here? :)

Cheers,
Jonathan

On 26 January 2018 at 13:54, Andrew Dinn <adinn at redhat.com> wrote:

> On 26/01/18 13:47, Jonathan Bluett-Duncan wrote:
> > Hmm, is that not what variables like the following are for?
> >
> > Function<@Nullable Integer, @Nonnull Integer> function = x -> (x ==
> null) ?
> > 0 : x + 1;
>
> My, how old-school having to actually inscribe in your program the
> semantics you intend for your code, plain for all to see and comprehend,
> when a super-smart (TM) compiler can simply invent them for you out of
> thin^H^H^H^H abundant white space.
>
> Look how many characters it requires to make your intentions clear. Not
> to mention the amount of thought required in order to be able to express
> them explicitly.
>
> This is progress and it cannot be resisted.
>
> regards,
>
>
> Andrew Dinn
> -----------
> Senior Principal Software Engineer
> Red Hat UK Ltd
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
>


More information about the jdk-dev mailing list