That's why I think they are silly. At this point, nothing gained vs simple prefixes. ONLY lost the ease of certainty that what you say actually holds true. And in fact, on the implementation side it usually doesn't hold true - I've rarely seen a namespaced implementation that uses full qualification.
Moreover "std::" is one character more, and a lot more noise, than "std_". Moreover in other common namespace syntaxes (like "std.") you still have the disadvantage that the namespace really is a separate lexical name (you could also write "std . foo" - it's logically, but not lexically, the same thing as "std.foo").
In conclusion, it's just a lot of unnecessary complexity. A complex solution looking for a problem.
> It also makes grepping much simpler. For example, I can grep a file for "std::"
With properly prefixed symbols you can do that as well. And more generally, you compile a list of symbols to grep for, or use other patterns (like std::.* tty .* or whatever) that likely don't match such an artificial namespace exactly. (In other words, namespaces are another opportunity for an implementor to get paralysed by choices he has to make, and another opportunity to be overly presupposing of how its API should be used by callers).
> As a side benefit, ...
Yeah I know I'm sounding a bit snarky now, but that's what linkers were invented for.
> Sure, but they can be aliased.
Even worse! It defeats "Now I always know where something is coming from." See my other comment here about "GlobalParams".
I like namespaces for this exact reason. Basically, never ever use "using namespace foo" or namespace aliasing and always fully qualify your symbols "foo::bar". Now I always know where something is coming from.
> it also makes use of crude tools like grep much less effective.
It also makes grepping much simpler. For example, I can grep a file for "std::" to find all standard library symbols used.
As a side benefit, while I said above never to use namespace aliasing, I did recently come across a situation where it was actually beneficial. The code in question was using std:: containers, but it would have been nice to be able to optionally use EASTL containers instead (which are mostly drop-in replacements with different performance characteristics). One simple way to do this would be to use a different namespace in place of std:: (I'm gonna just say foo:: for this example) and then do something like this:
> (Btw., namespace names could conflict as well ;-> )Sure, but they can be aliased.