On Friday, 9 March 2012 at 23:39:25 UTC, Steven Schveighoffer wrote:
I want to stress again the difference between C++'s namespaces, and D's module import mechanism. In C++, you *deliberately* pull a namespace into your scope (and usually only in the implementation file, which doesn't affect any other implementation files), whereas in D, a standard "import std.datetime" *automatically* pulls its namespace into your scope, and any public imports it has made.

To be honest, I don't quite see the big difference here. Just as you can only #include a »namespaced« file without using a using directive, you can »static import« a module in D. You seem to be arguing that we shouldn't encourage use of these features (cf. the std.log discussion), but I can't quite follow you there.

Why would _not_ using static and selective imports be desirable? Don't we generally discourage people from write »using namespace std« in C++ or »import *« in Python as well? (I'm aware that the D module system is different, but the general idea is the same)

David

Reply via email to