Boost logo

Boost :

From: Ed Brey (edbrey_at_[hidden])
Date: 2001-10-24 15:14:01


From: "Peter Dimov" <pdimov_at_[hidden]>
> >
> > > namespace math
> > > {
> > > float const pi_f = ...;
> > > double const pi = ...;
> > > long double const pi_l = ...;
> > > }
> >
> > I like this. The only disadvantage is that someone using, say floats, can't
> > get access to unqualified, minimally named constants with a simple using
> > statement. However, if we can assume use of anything besides double is
> > rare, this is OK.
>
> Actually I expect this to be a feature. You can't get access to minimally
> named literals when using floats, so for consistency I'd prefer to see the
> _f suffix on the math constants as well.
>
> But this is subjective.

Good observation. It's hard to argue with consistency.

> > Yes, to the non-generic part of the problem. It is still desirable to have a
> > generic interface, but it is allowed to be completely different.
> [...]
> > This would be in addition to the math::pi interface.
>
> And can be added later, if deemed necessary.
>
> It's always better to provide less and add later, than to provide more and
> then find ourselves unable to take some portions away.

Generally, I agree. The one caveat is synergy. You don't want to get everyone using a given interface only to find that with a little tweak, you could have had a common interface for both specific and generic needs. In this case, however, I've all but given up hope on finding a one-size-fits-all solution, and have resigned myself to a dual interface.

Still, a good generic interface is not rocket science, and I would hope that we can have it ready come review time for the library.


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