Boost logo

Boost :

Subject: Re: [boost] New dependency report
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-06-06 08:02:40


2014-06-06 15:17 GMT+04:00 Peter Dimov <lists_at_[hidden]>:

> Antony Polukhin wrote:
>
>> May be it would be better to move boost/mpl/bool.hpp,
>> boost/mpl/bool_fwd.hpp, boost/mpl/integral_c.hpp, mpl/or.hpp,
>> mpl/identity.hpp, mpl/and.hpp into the Core library?
>>
> <...>

> We might duplicate these as boost/core/something.hpp and
> boost::core::something, but they will not be quite the same as their mpl
> counterparts, and will not magically make a module that includes a
> boost/mpl/ header drop its dependency to MPL.
>

Yes, I what to do something close to "duplicate them in boost::core::". And
no, they won't differ from boost::mpl:: at all.

For example if we take a look at the <boost/mpl/identity.hpp> we'll see
that it depends on
#include <boost/mpl/aux_/lambda_support.hpp> and has macros inside it
(BOOST_MPL_AUX_LAMBDA_SUPPORT). This is a MPL only related macro and moving
<boost/mpl/identity.hpp> into core with that macro would be a bad idea.

But if we investigate further, we'll see that BOOST_MPL_AUX_LAMBDA_SUPPORT
macro expands to nothing on modern compilers. For antique-unsupported
compilers it does some work, but we do not support those any more.

It means that we can move identity.hpp into boost/core/identity.hpp:

namespace boost { namespace core {

template<typename T = na>
struct identity
{
    typedef T type;
};

template<typename T = na>
struct make_identity
{
    typedef identity<T> type;
};

}}

And modify <boost/mpl/identity.hpp>:

namespace boost { namespace mpl {

using boost::core::identity;
using boost::make_identity;

BOOST_MPL_AUX_NA_SPEC_NO_ETI(1, identity)
BOOST_MPL_AUX_NA_SPEC_NO_ETI(1, make_identity)

}}

Now some libraries could drop dependency to MPL by inclusion of
boost/core/identity.hpp

As John said, let's not get carried away. Module names, header directories,
> namespaces should match. boost/, boost/detail/, boost/pending/ headers that
> do not obviously belong to a specific module can arguably be considered
> fair game.

Totally agree. But some parts of the MPL look more like Core parts for
Boost (and C++ Standard library), rather than MPL parts. It's strange to
see that implicit_cast/algorithm/sync "uses meta-programming library",
however they only use identity<>/bool_.

I know that the idea is arguable, but there's something wrong with having
dependency to MPL in each Boost library.

-- 
Best regards,
Antony Polukhin

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