|
Boost : |
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2021-03-31 11:00:13
Hi Everyone,
I recommend to REJECT Boost.Lambda2 library in its current form. My opinion
is not very strong, and it is based on the perceived trade-off between
usefulness and technical problems.
I acknowledge that there are practical use cases that the library can
address, that are not provided in documentation. (I recommend that examples
with pointers, and maybe a complex one with column-oriented design be
added).
I consider the ADL issue that Barry pointed out a serious one. This will be
an additional place where users would suddenly be caught by a magical
problem that they will spend hours understanding. I think that the main
problem here is that Boost.Lambda2 defines the operators that should belong
to namespace std::placeholders. I also note that if this was added to the
Standard Library, the problem would be nonexistent, because they would
reside in namespace std.
Could I propose an alternative design. Add placeholders _1, _2, ... into
namespace `boost::lambda2::placeholders` specialize std::is_placeholder`
for them, so that `std::bind` can recognize them. Add operators in the same
namespace. Then, recommend the following usage of the library:
```
using namespace boost::lambda2::placeholders;
void fun()
{
auto pred = std::bind(_1, &Employee::name) == std::bind(_2,
&Employee::name);
}
```
This single using directive would make both `std::bind` and Boost.Lambda2
operators work. I would find such a library acceptable. And in fact I could
make it a condition for a conditional acceptance.
Now, the standard questions:
> - What is your evaluation of the design?
>
I object to the choice to add operators for placeholders from one namespace
(std::placeholders) into another namespace (boost::lambda2). Save for that,
I find anything else good.
- What is your evaluation of the implementation?
>
Very sweet and clean. I only expect other operators to also work. But Peter
already explained that this is his plan.
- What is your evaluation of the documentation?
>
This library doesn't require much documentation of the interface. But I
fill it is missing the Motivation section. I would expect to see practical
examples: not long ones, but ones that I will find in real programs, like
dealing with pointers.
- What is your evaluation of the potential usefulness of the library?
>
Others have convinced me that it will find sufficient application in real
programs.
- Did you try to use the library? With which compiler(s)? Did you
> have any problems?
>
I tried to reimplement it, and played with some toy examples in Wandbox.
(newest GCC). It worked fine.
- How much effort did you put into your evaluation? A glance? A quick
> reading? In-depth study?
>
I was able to reimplement it, read the entire implementation (which was not
difficult: it is like seventy lines). I spent like three hours in total
studying it.
- Are you knowledgeable about the problem domain?
>
I used Boost.Lambda and Boost.Bind in the past.
Finally, I would like to thank Peter for writing and sharing this library.
Regards,
&rzej;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk