help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %prefix with C++ namespaces


From: Joel E. Denny
Subject: Re: %prefix with C++ namespaces
Date: Tue, 2 Oct 2007 01:03:11 -0400 (EDT)

On Mon, 1 Oct 2007, Hans Aberg wrote:

> > It also occurs to me now that a leading "::" is not completely redundant.
> > The given namespace is used in two ways: for declarations and for
> > references.  The former needs the splitting we discussed.  I think the
> > latter would use the given namespace unaltered.  In that case, the leading
> > "::" would reference the global namespace absolutely.
> 
> Perhaps you missed it, but in another post, I compared C++ "::" to the "/" of
> UNIX filepaths. When it starts with "::", it is like a UNIX absolute or full
> path; otherwise, it is a relative path.

No, I get the analogy.  Did I say something to contradict it?

> > I'm having trouble
> > imagining important scenarios where this will actually help disambiguate a
> > reference.  However, the C++ compiler would complain in the scenario you
> > describe.
> 
> As for using a leading "::" for reference, I think that is admitted - or is my
> memory failing me? :-)

It's allowed.  My point is that, if the user has wrapped parser.cc in 
another namespace, the compiler will complain about any use of the 
absolute reference because it won't include that outer namespace.

In any case, I just tried wrapping parser.cc in a namespace, and it looks 
like there are many other compilation problems the user would have to work 
around anyway, so this issue is probably moot.

> I do not think the leading "::"-issue is very important - but it would be nice
> showing one has given thought to it. :-)

So, I'm seeing no reason to disallow it.  If the user wants absolute 
references, he should probably get absolute references.

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]