Boost logo

Boost :

From: Christian Mazakas (christian.mazakas_at_[hidden])
Date: 2021-03-27 02:45:39


Hey everyone,

I vote to *ACCEPT *Lambda2.

I first heard of Lambda2 when Peter asked me how many lines I thought
it would take to recreate Boost.Lambda.

Naturally, I should've seen this as a loaded question but I guessed a few
hundred. Maybe something just below a couple thousand by the time all
the dust settles.

Peter told me it could be done in ~50 lines. Now I was intrigued. The
source code of
Lambda2 is wonderfully clever and short. Moreso, sufficiently clever that
it's worth
not repeating every time we want to use it.

Higher-order functions are all the rage in C++ and writing lambdas is
cumbersome
and annoying. Lambda2 gives us a C++14 solution that relies on nothing else
but
simple language features and stdlib headers making it faster to compile
than older
solutions such as Phoenix or the original Lambda.

Lambda2 also has the fortune of interop'ing greatly with existing
constructs like
Boost.HOF and the new `<ranges>` STL header. See:
https://godbolt.org/z/hfxfhfEqv

Keeping this short, Lambda2 gives us fresh paint over an old technology
that we know
works and one that (while polarizing in its style) does its job well. I
think it ultimately
serves Boost and the larger C++ community to keep this Lambda-style of
coding alive
and well-maintained as C++ evolves.

- Christian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk