DIP61: Add namespaces to D
Michel Fortin via Digitalmars-d
digitalmars-d at puremagic.com
Sat Apr 26 13:18:03 PDT 2014
On 2014-04-26 09:31:51 +0000, Walter Bright <newshound2 at digitalmars.com> said:
> http://wiki.dlang.org/DIP61
>
> Best practices in C++ code increasingly means putting functions and
> declarations in namespaces. Currently, there is no support in D to call
> C++ functions in namespaces. The primary issue is that the name
> mangling doesn't match. Need a simple and straightforward method of
> indicating namespaces.
> ...
> As more and more people are attempting to call C++ libraries from D,
> this is getting to be a more and more important issue.
My opinion is that one shouldn't use namespaces in D.
But I do like this namespace concept. It sends the following message:
you're welcome to use a namespace if you like -- it'll work -- but 99%
of the time it'll only be some decoration in your source code that
users of your API can ignore at will because everything is still
available at module scope. (The 1% is when there is a name clash.) I
think it's a practical thing to do to avoid fake namespace substitutes
in D (look at std.datetime.Clock), even if it's a little dirty.
--
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca
More information about the Digitalmars-d
mailing list