Breadcrumbs won’t help – how not to get lost in a lambda forest

Speaker: Christian Hofmann

Audience level: Beginner | Intermediate

category

Lambdas are a very powerful tool which was introduced with C++11. They are handsome, inline function definitions, extremely useful to be used as callbacks. These neat little things make programming a lot easier, and are much nicer to read than std::binds. But…

The thing with tools is: the more powerful they are, the more havoc they can wreak if used unwisely. In a world of distributed specialist systems (microservices), there often are several components involved in a task – several components, which send several replies, which call several callbacks, each in their very own scope. And suddenly the neat little tool turns into a dark, menacing forest, ready to get lost in.

Breadcrumbs won’t help – but as always, there are strategies to prevent these forests, and strategies to cope with them, if forest-prevention is not an option anymore. The goal of this talk is to present some lambda-antipatterns “found in the wild" and how to work around these, giving aid to the Hänsels and Gretels who try to survive out in the lambda forests.