RFR: 8264707: HotSpot Style Guide should permit use of lambda

Xin Liu xliu at openjdk.java.net
Mon Aug 23 06:15:26 UTC 2021


On Sat, 21 Aug 2021 07:06:57 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> doc/hotspot-style.md line 708:
>> 
>>> 706: * Local function objects, including lambda expressions, may be used.
>>> 707: * Lambda expressions must only be used as a downward value.
>>> 708: * Prefer `[&]` as the capture list of a lambda expression.
>> 
>> hi, @kimbarrett , 
>> Why does it sound like a suggestion instead of a mandate? 
>> You explain why we should use [&] and all your examples are implicit capture reference.
>
> That's intentional. Capture lists were by far the single most contentious part
> of the Oracle-internal discussions about lambda usage. Making this a
> suggestion rather than a mandate, along with the rationale, leaves open the
> possibility of using other forms *with good reason*, and preferably after a
> period of folks getting used to the "usual" form. There are HotSpot developers
> who aren't familiar with lambda-like constructs, or are not comfortable with
> the introduction of yet more non-alphanumeric syntax that resembles line
> noise; limiting the capture list features being used helps them. On the other
> hand, there have been proponents of nearly every capture list feature for some
> use case or another.

Got it. Thanks for the explanation.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5144


More information about the hotspot-dev mailing list