Not-yet-discussed in HotSpot style guide: C++ Lambdas
Kim Barrett
kim.barrett at oracle.com
Sat Aug 14 18:25:40 UTC 2021
> On Aug 14, 2021, at 5:28 AM, Andrew Haley <aph-open at littlepinkcloud.com> wrote:
>
> https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md says:
>
> "Undecided Features
>
> This list is incomplete; it serves to explicitly call out some
> features that have not yet been discussed. ... Lambdas"
>
> I can't see any reason to forbid Lambdas from a performance point of
> view, and they can add to readability and maintainability in C++ for
> the same reasons that they do in Java.
>
> I have a job I'm working on (in the AArch64 back end) where Lambdas
> would be very useful. How about I give it a try, and I'll produce the
> patch for review, as an initial proposal? Then anyone can put in their
> 2c worth.
Funny you should mention lambdas. There has been a fair amount of
discussion around them internally here at Oracle. And there are some
folks trying them out in not-yet-ready-for-production work. I’ve drafted
a style-guide modification reflecting that discussion, along with a couple
examples, and am planning to open a PR in the next few days.
You can see the current work in progress here:
https://github.com/kimbarrett/openjdk-jdk/tree/permit_lambda
Note that I'm planning to rebase and do some commit refactoring / reordering
before opening the PR.
There is one downside that has recently been noted. Stack frame names
in stack traces where lambdas are involved are pretty indecipherable.
More information about the guide-dev
mailing list