why must a NamespaceAliasDeclaration's importIdentifier not be explicitlyGlobal?

Milian Wolff mail at milianw.de
Wed Jan 19 20:34:08 UTC 2011


David Nolden, 19.01.2011:
> In C++, all imports are first resolved using findDeclations(..), and that
> is why the resulting identifiers are never explicitly global.

Right, I found that as well. But what should be returned?

namespace asdf {

using namespace ::foobar;

}

Why can this not be an import with explicitly global identifier ::foobar? What 
is it if not this? the same, just not explicitly global?
 
> Am 19.01.2011 09:07 schrieb "David Nolden" <zwabel at googlemail.com>:
> 
> I think, this is only for consistency. A namespace alias declaration
> is always global, and the "explicitly global" flag is simply not
> required. That flag is actually just a flag for lookup. For example,
> when you call "declaration->qualifiedIdentifier()", then the result
> also does not have this flag set, even though it is global of course.
> 
> The flag could be removed in setImportIdentifier. However, when you
> sometimes set an import identifier _with_ the flag and sometimes
> _without_, then you'll be probably doing something wrong, after all
> the "explicitly global" should have some special meaning in your
> language.

I don't think this should be enforced, this works the same way, no:

namespace foobar {}

namespace asdf1 {
using namespace foobar;
}

namespace asdf2 {
using namespace ::foobar;
}

Here, we have once a namespace include of foobar (not global, but - since no 
local namespace called foobar exists, maps to the global foobar). And then 
below, more explitly, the import to ::foobar.

What is wrong with having two declarations with differing include imports 
here?

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110119/14859025/attachment.sig>


More information about the KDevelop-devel mailing list