DIP 1007 Preliminary Review Round 1

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 24 15:22:14 PDT 2017


On Monday, 24 April 2017 at 15:22:15 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 24 April 2017 at 15:03:53 UTC, Mike Parker wrote:
>> DIP 1007 is titled "'future symbol' Compiler Concept".
>
> «In all the mentioned languages but D, a common convention is 
> to only use unqualified access for symbols in the standard 
> library.»
>
> Not quite right for C++. The common convention in modern C++ is 
> to use full std::name qualification for the standard library. 
> It is common to use unqualified access for the local 
> namespace(s) only.

In headers. Not in source files, and I don't know why anyone 
would want to keep typing `std::` all the time. Do some people do 
what you're describing? Yes, but I see no evidence that that's 
the common convention in modern C++. In fact, from the core 
guidelines:

"
##### Example

     #include<string>
     #include<vector>
     #include<iostream>
     #include<memory>
     #include<algorithm>

     using namespace std;

     // ...

Here (obviously), the standard library is used pervasively and 
apparently no other library is used, so requiring `std::` 
everywhere could be distracting."

Never mind the monstrosity that would be trying to use the C++ 
user-defined literal without `using namespace std`:

#include <string>
using namespace std::operator""s;  // Argh! My eyes!

No thanks. I even had to look that up, and I'll probably forget 
it.


More information about the Digitalmars-d mailing list