What happened to JEP-302 (Lambda Leftovers) ?
maurizio.cimadamore at oracle.com
Fri Apr 29 17:30:15 UTC 2022
your question is on point.
The JEP is consists of two main features:
* tweak the shadowing rules for lambda parameters, so that lambda
parameter can shadow local variable from enclosing scopes
* use `_` as an unspecified lambda parameter name
While we have developed viable prototypes for both , we started to
feel that the scope of JEP 302 was too narrow. That is, that JEP focuses
mainly on enhancing usability of lambda expression, but some of the
proposed solutions would be, in fact, be applicable in other contexts as
well. For instance, using `_` as an unspecified name could be useful in
exception parameter names, method parameter names, binding variables,
etc. . Similarly, while improving shadowing for lambda parameters can
yield dividends (esp. in certain API such as Map::computeIfAbsent),
other language features, such as pattern matching, suffer from similar
problems (e.g. pattern variables can't shadow enclosing local variables).
For these reasons, we believe that this JEP no longer reflects the
entirety of our thinking on these matters. As such, we propose that the
JEP should be withdrawn. Of course that doesn't mean that some of the
issues mentioned in the JEP will not be addressed. In due course they
will, but with a more holistic perspective: after all, a lot has changed
in the Java language since JEP 302 first appeared.
On 29/04/2022 14:19, Tobias Gierke wrote:
> I always feel like it's going to get included in the next JDK release
> ... and yet it never happens :( Is there a specific reason for that,
> other than lack resources ?
More information about the discuss