JEP proposed to target JDK 11: 323: Local-Variable Syntax for Lambda Parameters
Cédric Champeau
cedric.champeau at gmail.com
Fri Jan 26 08:38:23 UTC 2018
Hi Martijn,
I share your thoughts. I understand the will to streamline the use of
"var". However, since
(var x, var y) -> x+y
is strictly equivalent to:
(x,y) -> x+y
I'm not sure I see the advantage of this. From my experience with Groovy,
where both are supported ( { def x, def y -> ) and ( { x,y ->), I think
most people stick with the short syntax, the longer one seems to imply
different semantics (why use a different syntax if its the same ?), where
there are not.
2018-01-26 9:30 GMT+01:00 Martijn Verburg <martijnverburg at gmail.com>:
> Hi all,
>
> I'm struggling to understand the motivation for this JEP in terms of it
> adding improved understanding or readability of source code (as the
> implicit case is already covered today).
>
> I also suspect the illegal use uses (extract below) will likely confuse and
> frustrate day to day developer's who don't understand the underlying type
> inference system and lead to
> some heavily upvoted SO Q's. I liken this type of frustration seen in
> developers not understanding generics in full and coming undone in corner
> cases where they expect the element of
> 'least surprise'.
>
> ------
>
> The following examples are illegal:
>
> (var x, y) -> x + y // Cannot mix var and "no var" in
> implicitly typed lambda expression
> (var x, int y) -> x + y // Cannot mix var and manifest types in
> explicitly typed lambda expression
>
>
> -------
>
> I'm not sure I've explained myself very eloquently here, hope this has made
> some sense.
>
> Cheers,
> Martijn
>
> On 26 January 2018 at 08:40, <mark.reinhold at oracle.com> wrote:
>
> > The following JEP is proposed to target JDK 11:
> >
> > 323: Local-Variable Syntax for Lambda Parameters
> > http://openjdk.java.net/jeps/323
> >
> > Feedback on this proposal is more than welcome, as are reasoned
> > objections. If no such objections are raised by 23:00 UTC on Thursday,
> > 1 February, or if they're raised and then satisfactorily answered, then
> > per the JEP 2.0 process proposal [1] I'll target this JEP to JDK 11.
> >
> > - Mark
> >
> >
> > [1] http://cr.openjdk.java.net/~mr/jep/jep-2.0-02.html
> >
>
More information about the jdk-dev
mailing list