Accessing class with module name as Java's
tcak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 12 18:41:22 PST 2015
On Monday, 12 January 2015 at 18:11:35 UTC, bearophile wrote:
>
> D modules can contain lot of stuff, like variables, constants,
> enums, types, structs, etc. And you usually put more than one
> class in each D module. Also D class names should be
> capitalized (like "Project").
>
>
>> When I do this, it works, but I cannot make it work with
>> namespace unfortunately.
>
> What namespace? D has modules, unlike C++. In general it's a
> bad idea to have inside a module a name (like a variable name
> or struct name) equal to the module name, because it causes
> confusion.
>
> Please show what doesn't work.
>
> Bye,
> bearophile
With namespace, I mean like "core.sync.mutex", not just "mutex".
As you will find lots of examples in even in Phobos, there are so
many name duplications.
Example: core.sync.mutex.Mutex, core.thread.Thread
Like it or don't, it is ugly. And I am sure, those modules are
designed in that way, because of not being able to what I am
asking about. Because D can contain many things doesn't mean it
is any better, I am using it for many years already.
More information about the Digitalmars-d-learn
mailing list