This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: namespaces -- time to do something?


>>>>> Marc W Mengel <mengel@fnal.gov> writes:

> Well, now that egcs-1.0 is out, it seems to me it's time to do something
> about namespaces for egcs-1.1.  Towards that end, I have a simple idea
> that I think will work which I'd like to toss out for folks to knock
> around.

I've already sent out my design for a rewrite of the lookup code, which is
already ill-suited to C++.  I'll see about digging it up again.

> Proposal:
> ---------
> If so, I propose we fix this by adding the following tokens to the grammar:

> %token NAMESPACE_ID_ALIAS 
> %token NAMESPACE_TYPE_ALIAS 
> %token NAMESPACE_NAMESPACE_ALIAS

This seems unnecessary.  A using-declaration can be found using the same
lookup as any other declaration, and should use the same tokens.

> The only slightly painful part is when we see a "using xxx;" statement to
> import a whole namespace, we have to make aliases for the whole list of 
> symbols in the namespace...

No.  That's not how using-directives work.  In particular, names added to
the used namespace after the using-directive are also visible.  Also, the
lookup in the used namespace happens at the least common denominator of the
current scope and the used namespace.  Using-declarations are easy;
using-directives are the hard part.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]