Boost logo

Boost :

Subject: Re: [boost] Boost policy for putting headers in boost/ Was: #3541 Support <boost/ptr_map.hpp>
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-10-23 14:08:15


Joel de Guzman wrote:
> Stewart, Robert wrote:
> >
> > How about "_"? Is "_.hpp" legal in all supported
> > filesystems? Since we're talking about
> > libraries, and not applications, how about "main.hpp?"
> > "main" is still very short and
> > would be consistent.
>
> To be honest, I find the lib/main.hpp idea not bad at all
> (except for the
> extra typing involved vs. lib.hpp). However, following

lib.hpp works fine, too.

> existing practice,
> and not breaking existing code, IMO, far outweigh the problem you
> have with tab completion: that can never be a valid rationale
> for breaking existing code.

I agree. However, the tab completion problem merely highlights the noisiness of the directory plus like-named header approach. That also affects directory listings and directory navigation dialogs.

> Fusion simply follows existing practice and
> extends it to
> the next level of modularity. There were two existing practice at the
> time when I wrote fusion:
>
> lib/
> lib.hpp
>
> and
>
> lib/
> lib/lib.hpp
>
> I find the latter redundant. I chose to follow the first.

IOW, there isn't one approach now. If we adopt a single approach, some code will break. Granted, in the latter case, lib/lib.hpp can be copied to lib.hpp and thus make it like the former, but at some point, lib/lib.hpp should be removed, and that will be a breaking change.

#include <boost/libname.hpp>

is simpler than

#include <boost/libname/libname.hpp>

or

#include <boost/libname/lib.hpp>

but that's not the whole story. Adopting a single approach will break existing libraries:

1. Suppose libname/lib.hpp is the choice. Existing libraries would add libname/lib.hpp and later remove libname.hpp or libname/libname.hpp.

2. Suppose libname + libname.hpp is the choice. Libraries using libname/libname.hpp must add libname.hpp and later remove libname/libname.hpp.

3. Suppose libname/libname.hpp is the choice. Libraries using libname + libname.hpp must add libname/libname.hpp and later remove libname.hpp.

The question, then, is which approach is the most helpful across the use cases, when ignoring the breakage? As noted above, referencing the "all" headers in include directives is simplest in #2; is that a sufficient justification for that approach over the others? It doesn't address tab completion or the find-uses-of-lib.hpp-to-improve-build-times use cases, but perhaps those are less important.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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