math icon indicating copy to clipboard operation
math copied to clipboard

Cyclic dependency Math <-> Random

Open Kojoley opened this issue 4 years ago • 6 comments

The only use of Random is boost/random/uniform_real_distribution.hpp in boost/math/tools/ulps_plot.hpp. I am not familiar with the code, but may be there is a way to rewrite it without using Random?

Kojoley avatar May 26 '20 16:05 Kojoley

We could use std::random with a bunch of casting, though we wouldn't be able to query abscissas that are not representable as float, double, and long double.

Is it super important that we don't cross-use features from other boost libraries? One of the main reasons I enjoy developing in boost is that I can benefit from a wide variety of things within the library.

NAThompson avatar May 26 '20 16:05 NAThompson

It depends, you might saw reoccurring mailing list posts about that, as well as currently ongoing discussion. For me, it will not after #151 is resolved, but as for now the new header introduced two new dependencies, and one of which is cyclic, what usually indicates a wrong logical split between libraries.

Kojoley avatar May 26 '20 17:05 Kojoley

Ok, if this is gonna make a mess, I'll go ahead and try to clean it up. This hasn't been released yet, so we can make backwards-incompatible changes.

Let me think about how this should be done; it's not obvious to me.

NAThompson avatar May 26 '20 18:05 NAThompson

@NAThompson : one of the ideas I've been toying with (which I think you first suggested!) was having the option for Math and Multiprecision to sit standalone without the rest of Boost if required. It would require the transition to C++11 or later next year though...

jzmaddock avatar May 26 '20 18:05 jzmaddock

@jzmaddock : Is there any way we could do a module while preserving what we have for C++11 users?

NAThompson avatar May 27 '20 02:05 NAThompson

Is there any way we could do a module while preserving what we have for C++11 users?

I confess not to know enough about the current modules proposal to say for sure - but I sure hope so!

jzmaddock avatar May 27 '20 12:05 jzmaddock