[Issue 1509] Need a way to create namespaces inside modules

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 14 05:17:35 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=1509


dawg at dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dawg at dawgfoto.de


--- Comment #4 from dawg at dawgfoto.de 2012-02-14 05:17:33 PST ---
Importing into functions, templates and structs do work now.
The cleanest way to fake a namespace is to alias a template.

----
cat > test.d << CODE
template MyNameSpace_()
{
  import std.stdio;

  void foo()
  {
      writeln("MyNameSpace.foo");
  }
}
alias MyNameSpace_!() MyNameSpace;

void main()
{
    MyNameSpace.foo();
}
CODE

dmd -run test.d
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list