|
Boost : |
From: Ed Brey (brey_at_[hidden])
Date: 1999-12-16 09:02:32
John Maddock wrote:
>
[Hiding implementation details inside a uniformly named namespace.]
>
> Good idea, but is it worth adopting the underscore + upper case approach -
> this is reserved in global namespace and in namespace std, but allowed in
> other namespaces, the ambiguity that I *think* it resolves is:
>
> #include <boost/some_header.hpp>
> #include <other.hpp>
>
> using namespace boost;
>
> detail::myclass c; // ambiguity is this ::detail or boost::detail?
>
> in contrast "_Detail" should never appear as a namespace or namespace
> qualifier at global scope.
>
> Hope I've got this right :-)
I'm confused here. First off, IIRC, the following names are reserved:
(1) _* at global scope.
(2) __* at any scope.
(3) _[A-Z]* at any scope.
So we couldn't call our detail namespace "_Detail", since that name is
reserved to the implementation. We could call the namespace
"_detail"; however, I don't see why we need to worry about name
collision in the first place. Your example shows what looks like user
code accessing something out of the detail namespace. This should
never happen, by definition of "implementation detail". The detail
namespace should only ever be referenced by boost code, and so the
reference will always come from within the "namespace boost {}"
scoping, so even if there is a "detail" namespace at global scope, the
boost::detail namespace will be unambiguously chosen over it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk