How about Go's... error on unused imports?

Justin Johansson no at spam.com
Thu Nov 12 18:37:48 PST 2009


Leandro Lucarella Wrote:

> I'm sorry to bring up another "How about Go's ..." topic, but I think this
> feature is very in sync with D and it should be really easy to implement.
> 
> Go issues an error if you have an import that's never used, to avoid
> unnecessary dependencies.
> 
> Do you see any reasons not to do that? I think it happens very often to
> stop using some import and never notice it.
> 

In my opinion, this is a very good idea.  I continually remove imports
when I think they might not be used anymore.  Sometimes I'm right
and sometimes I'm wrong and the compiler tells me accordingly.  It
would be nice to have a warning for unused imports to save the tedium
of a redo.

>From a code understanding point of view it helps not to be obfusticated
by unused imports.

beers Leandro for picking this up,

Justin





More information about the Digitalmars-d mailing list