3 ms·
C++ Lambda Idioms (2022) [video]
- i_am_a_peasant 3y agoGood 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.
- gemstones 3y agoOut 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.
- i_am_a_peasant 3y agoAt 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.
- jhasse 3y agoYou mean like Cpp2? https://github.com/hsutter/cppfront https://github.com/hsutter/cppfront
- i_am_a_peasant 3y agoIt's a start, but it would also be nice to also have a package manager and integrated unit test framework. cmake is a pain.
- tcbawo 3y agoLocality also improves readability. Lambdas for std::algorithm functions are intuitive and concise. Like everything, they can be misused.
- thom 3y agoNot 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.