www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3507] New: [module] Flag unused imports to avoid unnecessary dependencies

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

           Summary: [module] Flag unused imports to avoid unnecessary
                    dependencies
           Product: D
           Version: future
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: llucax gmail.com



PST ---
Dependencies makes compile time increase in large projects and have other bad
impact in the code. An import might even execute code (module ctors), which can
make the program slower at *run-time* unnecessarily if the module is not really
used.

I think unused import should trigger *at least* an optional warning (with -w or
something) to aid the programmer in detecting unused modules. A way to tell the
compiler that an unused module is OK should be provided (in case we need the
module ctor to run), a possible syntax is a special renamed import:

import void = foo.bar.baz;

A special selective import can do the job too:

import foo.bar.baz: void;

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