[Issue 11158] New: __MODULE__ as default template parameter doesn't use the instantiating module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 2 11:09:37 PDT 2013


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

           Summary: __MODULE__ as default template parameter doesn't use
                    the instantiating module
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at dawg.eu


--- Comment #0 from Martin Nowak <code at dawg.eu> 2013-10-02 11:09:36 PDT ---
cat > buga.d << CODE
struct Uniq(string name, string mod=__MODULE__)
{
  pragma(msg, name, mod);

  string toString() { return mod~"."~name; }
}
CODE

cat > bug.d << CODE
import buga;

alias UniqFoo = Uniq!("foo");
CODE

dmd -c bug;

----

As with __FILE__ or __LINE__ they should be used from the instantiating module.
This allows to generically implement somewhat unique types and is useful for
printing additional information.

-- 
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