Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
C++ Lambda Idioms (2022) [video] (youtube.com)
54 points by lichtenberger on Nov 13, 2023 | hide | past | favorite | 7 comments


Good god kill it with fire. If lambdas have so many subtleties they're more trouble than they're worth.

You know what improves readability? Writing a function and giving it an explicit suffix like _callback or _filter_condition or _ordering.

C++ Lambdas can respectfully get flushed down the toilet with most of the C++ standard and the 10 billion cases of undefined behavior you have to keep in the back of your head at all times.


Locality also improves readability. Lambdas for std::algorithm functions are intuitive and concise. Like everything, they can be misused.


Out of curiosity, I wonder it there's a group that would be willing to sponsor a C++ standard that is just a subset of the current C++ one?

Having the standard, and the ABI, seems valuable. And it would be a lot of trouble to write one from scratch. But it would be less trouble, probably, to go through the standard and remove things that could be safely removed.


At this point I'm just betting that someone is going to write a TypeScript for C++. Until then, I'm sticking to Rust. I just want to get the job done and make money, and so far the ROI on Rust has been HUGE for me. I can't remember the last segfault I've seen.



It's a start, but it would also be nice to also have a package manager and integrated unit test framework. cmake is a pain.


Not sure if you've seen std::visit or if it's covered in this talk, but it's another triumph of the possible over the sensible using C++ lambdas.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: