[Issue 10437] Warnings for unused private imports

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 21 06:52:58 PDT 2013


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



--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2013-06-21 06:52:57 PDT ---
(In reply to comment #3)
> I think the question is misleading. The actual question is how clever the
> analysis is. Call-graph information provides a similar scenario:
> 
> import std.stdio;
> 
> void foo() {
>     writeln("foo");
> }
> 
> void main () {}
> // foo is never called
> 
> In such scenarios, deleting a statement might declare a whole chain (actually
> DAG) of (template or normal) functions unused. It is a question of taste, if
> the user should be flooded with warnings in this case.

It's impossible to do that strictly with templates. Let's try to show more
suitable case.

import std.conv;
import std.stdio;

auto call(string name, A...)(A args)
{
    return mixin(name~"(args)");
}

Until 'call' template function is instantiated, compiler cannot determine which
import declaration is actually unused.

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