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;
I'm assigning this to bootcamp although it's a large-ish project, probably appropriate for a separate tool.
Yes, this is a perfect fit for dmd as a library. This is not going to make it in the compiler reference implementation.