Reducing dependencies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Reducing dependencies

Boost - Dev mailing list
Hello,

I've noted that many libraries depend on container_hash while it
depends only on a single header from Boost.Detail library
https://pdimov.github.io/boostdep-report/master/module-levels.html

Can we move "boost/detail/container_fwd.hpp" into Boost.Core or into
Boost.ContainerHash? This will break the circular dependency, move the
Boost.ContainerHash on level 4 and improve levels of Intrusive,
Container, CircularBuffer, Unordered, Algorithm, Test, TypeIndex, Any,
Function, Functional, ScopeExit, Signals, MultiArray, Variant.


--
Best regards,
Antony Polukhin

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
Le 25/03/2018 à 11:18, Antony Polukhin via Boost a écrit :

> Hello,
>
> I've noted that many libraries depend on container_hash while it
> depends only on a single header from Boost.Detail library
> https://pdimov.github.io/boostdep-report/master/module-levels.html
>
> Can we move "boost/detail/container_fwd.hpp" into Boost.Core or into
> Boost.ContainerHash? This will break the circular dependency, move the
> Boost.ContainerHash on level 4 and improve levels of Intrusive,
> Container, CircularBuffer, Unordered, Algorithm, Test, TypeIndex, Any,
> Function, Functional, ScopeExit, Signals, MultiArray, Variant.
>
>
Yes, please, move it to a specific Boost.ContainerHash.

I don't mind having more components, if we reach to manage better the
dependencies.

Vicente


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
On 7 April 2018 at 09:58, Vicente J. Botet Escriba via Boost
<[hidden email]> wrote:

> Le 25/03/2018 à 11:18, Antony Polukhin via Boost a écrit :
>>
>> Hello,
>>
>> I've noted that many libraries depend on container_hash while it
>> depends only on a single header from Boost.Detail library
>> https://pdimov.github.io/boostdep-report/master/module-levels.html
>>
>> Can we move "boost/detail/container_fwd.hpp" into Boost.Core or into
>> Boost.ContainerHash? This will break the circular dependency, move the
>> Boost.ContainerHash on level 4 and improve levels of Intrusive,
>> Container, CircularBuffer, Unordered, Algorithm, Test, TypeIndex, Any,
>> Function, Functional, ScopeExit, Signals, MultiArray, Variant.
>>
>>
> Yes, please, move it to a specific Boost.ContainerHash.
>
> I don't mind having more components, if we reach to manage better the
> dependencies.

IMO the problem is that detail depends on MPL. It really shouldn't be
an expensive dependency, and shuffling things around is just causing
extra complication while avoiding dealing with the real problem. Most
uses of MPL can be replaced with more lightweight functionality. I
think the only exception is the support for MPL lambdas which I don't
think is necessary. I haven't checked but there's a decent chance
they're not used at all in Boost (and since it's detail they aren't
for public use), and I don't think the workarounds are required for
any of the compilers in use nowadays anyway.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
On Sat, Apr 7, 2018, 12:58 Daniel James via Boost <[hidden email]>
wrote:

> On 7 April 2018 at 09:58, Vicente J. Botet Escriba via Boost
> <[hidden email]> wrote:
> > Le 25/03/2018 à 11:18, Antony Polukhin via Boost a écrit :
> >>
> >> Hello,
> >>
> >> I've noted that many libraries depend on container_hash while it
> >> depends only on a single header from Boost.Detail library
> >> https://pdimov.github.io/boostdep-report/master/module-levels.html
> >>
> >> Can we move "boost/detail/container_fwd.hpp" into Boost.Core or into
> >> Boost.ContainerHash? This will break the circular dependency, move the
> >> Boost.ContainerHash on level 4 and improve levels of Intrusive,
> >> Container, CircularBuffer, Unordered, Algorithm, Test, TypeIndex, Any,
> >> Function, Functional, ScopeExit, Signals, MultiArray, Variant.
> >>
> >>
> > Yes, please, move it to a specific Boost.ContainerHash.
> >
> > I don't mind having more components, if we reach to manage better the
> > dependencies.
>
> IMO the problem is that detail depends on MPL. It really shouldn't be
> an expensive dependency, and shuffling things around is just causing
> extra complication while avoiding dealing with the real problem. Most
> uses of MPL can be replaced with more lightweight functionality. I
> think the only exception is the support for MPL lambdas which I don't
> think is necessary. I haven't checked but there's a decent chance
> they're not used at all in Boost (and since it's detail they aren't
> for public use), and I don't think the workarounds are required for
> any of the compilers in use nowadays anyway.
>

In that case I'd love to see both changes:
* dropping circular dependency container_hash <=> detail
* dropping dependency of detail on mpl

With both changes much more libraries improve in dependency levels.

>

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Daniel James wrote:

> IMO the problem is that detail depends on MPL. It really shouldn't be an
> expensive dependency, and shuffling things around is just causing extra
> complication while avoiding dealing with the real problem. Most uses of
> MPL can be replaced with more lightweight functionality.

This looks doable, the problem is that the Detail components that use MPL
have no tests, so it won't be easy to determine whether the changes break
something.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 7 April 2018 at 13:53, Antony Polukhin <[hidden email]> wrote:
>
> In that case I'd love to see both changes:
> * dropping circular dependency container_hash <=> detail
> * dropping dependency of detail on mpl
>
> With both changes much more libraries improve in dependency levels.

Isn't the circular dependency because of the dependency on mpl?

container_hash -> detail -> mpl -> utility -> iterator -> fusion ->
container_hash

It won't break over circular dependencies though, e.g. mpl and utility
depend on each other.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
Daniel James wrote:

> Isn't the circular dependency because of the dependency on mpl?
>
> container_hash -> detail -> mpl -> utility -> iterator -> fusion ->
> container_hash

It is... was. I'll regenerate the report. utility->iterator (because of
utility.hpp->next_prior.hpp) is no longer.

> It won't break over circular dependencies though, e.g. mpl and utility
> depend on each other.

I think I fixed that too. Utility no longer depends on MPL.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 7 April 2018 at 14:02, Peter Dimov via Boost <[hidden email]> wrote:

> Daniel James wrote:
>
>> IMO the problem is that detail depends on MPL. It really shouldn't be an
>> expensive dependency, and shuffling things around is just causing extra
>> complication while avoiding dealing with the real problem. Most uses of MPL
>> can be replaced with more lightweight functionality.
>
>
> This looks doable, the problem is that the Detail components that use MPL
> have no tests, so it won't be easy to determine whether the changes break
> something.

We can write tests if needed, but it won't be hard to work out which
modules use the various parts of detail, so we can track their tests.
Several headers are only used by one to two libraries.

Another, possibly better, solution is to not use container_fwd.php. It
doesn't do any good for libc++ and libstdc++ because of the way they
use namespaces for versioning.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
Daniel James wrote:

> We can write tests if needed, but it won't be hard to work out which
> modules use the various parts of detail, so we can track their tests.

It's not hard, I agree. :-)

C:\boost-git\develop>dist\bin\boostdep.exe boost/detail/is_xxx.hpp
Inclusion report for <boost/detail/is_xxx.hpp> (in module detail):

    from parameter:
        <boost/parameter/parameters.hpp>

    from python:
        <boost/python/detail/is_xxx.hpp>

C:\boost-git\develop>dist\bin\boostdep.exe boost/detail/is_incrementable.hpp
Inclusion report for <boost/detail/is_incrementable.hpp> (in module detail):

    from icl:
        <boost/icl/type_traits/is_discrete.hpp>

    from iostreams:
        <boost/iostreams/detail/resolve.hpp>

    from iterator:
        <boost/indirect_reference.hpp>
        <boost/iterator/new_iterator_tests.hpp>
        <boost/pointee.hpp>

and so on.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Daniel James wrote:

> Another, possibly better, solution is to not use container_fwd.php. It
> doesn't do any good for libc++ and libstdc++ because of the way they use
> namespaces for versioning.

Well...

C:\boost-git\develop>dist\bin\boostdep.exe boost/detail/container_fwd.hpp
Inclusion report for <boost/detail/container_fwd.hpp> (in module detail):

    from container_hash:
        <boost/container_hash/extensions.hpp>

    from lambda:
        <boost/lambda/detail/operator_return_type_traits.hpp>


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 07/04/2018 15:24, Daniel James via Boost wrote:
> We can write tests if needed, but it won't be hard to work out which
> modules use the various parts of detail, so we can track their tests.
> Several headers are only used by one to two libraries.
>
> Another, possibly better, solution is to not use container_fwd.php. It
> doesn't do any good for libc++ and libstdc++ because of the way they
> use namespaces for versioning.

It's possible to handle that. I think forward declaration of those
containers might be possible and really useful. Pulling a std header is
really hard. The main problem is that in some libraries some elements
are in the std namespace and others in the inline namespace.

An example using std_ns_begin.hpp/std_ns_end.hpp forward declaring some
STL utilities:

https://github.com/boostorg/container/blob/develop/include/boost/container/detail/std_fwd.hpp

It's a hack, but a really useful one if you don't want to pull half STL
when writing a simple header.

Ion

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
On 8 April 2018 at 05:21, Ion Gaztañaga via Boost <[hidden email]>
wrote:

> It's a hack, but a really useful one if you don't want to pull half STL
> when writing a simple header.
>

Isn't this "hack" actually specifically dis-allowed by the standard? (don't
seek to discuss it, just a question)

degski

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Reducing dependencies

Boost - Dev mailing list
On 08/04/2018 14:49, degski via Boost wrote:
> Isn't this "hack" actually specifically dis-allowed by the standard? (don't
> seek to discuss it, just a question)

Yes, it's disallowed. But since:

-> We have a problem.
-> There is no portable solution.
-> There is are different solutions that cover nearly all platforms.

...a library in Boost dealing with this might be a good idea. Just like
we had threads long before the standard allowed them and we have
coroutines before the standard allows it.

Best,

Ion


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost