www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11158] New: __MODULE__ as default template parameter doesn't use the instantiating module

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: code dawg.eu



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: -------
Oct 02 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11158


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



19:07:11 PDT ---
See https://github.com/D-Programming-Language/dmd/pull/2617

*** This issue has been marked as a duplicate of issue 4018 ***

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