[Issue 16532] Add "namespace" Keyword?

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 21 13:31:26 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16532

b2.temp at gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp at gmx.com

--- Comment #3 from b2.temp at gmx.com ---
(In reply to Jack from comment #2)
> Exactly, name spaces are supported but only through an extern. If I want to
> write D code with namespaces it isn't possible. Hence a lack of completeness.
> 
> You can't use a template without a parameter?
> 
> template Name()
> {
>     enum a = 2;
>     enum b = 3;
> }
> 
> writeln(Name.a, Name.b); // error Name has no property a or b

You must alias it to create an instance.

alias name = Name!();

and in the code use this alias.

But you know, namespaces will never be added. D has modules, end of story. Ask
on the news group and you'll see...You can even close this issue.

--


More information about the Digitalmars-d-bugs mailing list