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

Nick Sabalausky a at a.a
Fri Nov 13 13:50:11 PST 2009


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:hdjhuu$10f9$1 at digitalmars.com...
> Leandro Lucarella:
>
>> 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.
>
> I think I'd like d compilers to have a switch (-wunused ?) that when 
> present warns me for unused variables, functions, imports, classes, etc. 
> This helps keep the code tidy and tight. Then later IDEs can use this 
> output to underline what's unused.
>
> I use -Wall in C and I find it useful when it tells me that there are 
> unused variables. Unused variables can be stuff that I need to use but I 
> have forgotten to use, or stuff that I have used in an older version of 
> the code and now are not used anymore, etc. Sometimes variables are not 
> used because conditional compilation has disabled a part of the code that 
> uses that variable. In this case I may want to move the variable 
> definition inside the optionally compiled part of the code, this improves 
> the code a little. In many situations I want to know if I have not used 
> them.
>
> Bye,
> bearophile

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





More information about the Digitalmars-d mailing list