[Issue 9948] New: -deps dependency printing incorrect for templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 17 05:49:40 PDT 2013


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

           Summary: -deps dependency printing incorrect for templates
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jfanatiker at gmx.at


--- Comment #0 from jfanatiker at gmx.at 2013-04-17 05:49:39 PDT ---
Currently the emitted dependencies are incorrect for templates:

Dependencies are emitted for the module that references the dependency, even if
this reference is within a template. This is incorrect, as only the code
instantiating the template really depends on the template dependencies, there
is no need to rebuild a module, if an import within a template changes.

Consider this simplified example, which makes the issue most clear:
```D
// module a
void templateFunc(string myImport)() {
   mixin(myImport);
// ....
}

// module b:
void main() {
   templateFunc("import std.string;")();
}
```
It seems a bit artificial, but in fact it is not (consider Diet templates for
example). In this example the dependencies for module "a" change, depending on
what code it uses.

The effect is not severe, it will just make build tools less efficient, because
modules need to be compiled needlessly, it should nevertheless be fixed.

I have a patch in the works already.

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