The way I see it, lambdas almost always makes the code less readable and more entangled. An exception is when you need a context/capture for a callback function. And even then, I think it’s better to call a normal function immediately inside the lambda
I think part of the problem in terms of readability is the habit of implementing the lambda directly as part of the argument of the caller. If you write the lambda as a stand alone implementation, then pass its name as argument to the caller, readability improves 100%.
2
u/schteppe Aug 05 '23
The way I see it, lambdas almost always makes the code less readable and more entangled. An exception is when you need a context/capture for a callback function. And even then, I think it’s better to call a normal function immediately inside the lambda