[PATCH][PR c++/21494] condensed nested namespaces

Petr Machata pmachata@redhat.com
Mon Dec 12 17:58:00 GMT 2005


> | 
> | So you think that there should be ordinary name resolution done for
> | (possibly) qualified identifier in namespace? Why isn't mere opening a
> | namespace enough? But it means that namespace a::b::c can't be used
> | before you have namespace a { namespace b { namespace c {}}} somewhere
> | ahead, doesn't it?
> 
> Yes, that is my current thinking.

That goes agains a proposal, imho. The idea is to replace the literate 
  namespace a { namespace b { }}
with condensed
  namespace a::b {}
isn't it? So requiring the namespace to be open beforehand is...
cumbersome. From my point of view, anyway.

> 
> | I think there are pracitally no clean uses for namespace ::a. So I'd
> 
> What counts as "clean"?  

Ok, sorry for that one.

> Explicitly qualification with leading "::" is common in some
> community, I would not go moralize them about it -- even when I think
> the condensed form should be permitted only for namespace-extension.

Yes, I can imagine. I use it quite often, when I want to be sure that I
get the correct type. But with opening namespaces? 
I'd rather preserve as much of semantics as possible, and I'm afraid
that opening completely foreign namespace from inside arbitrary other
namespace changes it. On the other hand, comprehending two nested
namespaces into one qualified is pure syntactic sugar.

> 
> | most probably just disallow initial `::' and just open one named
> | namespace per identifier. Actually, that's the way I have written the
> | patch initially...
> 
> -- Gaby

PM



More information about the Gcc-patches mailing list