Unused variables, better as error or warning?

Simen kjaeraas simen.kjaras at gmail.com
Fri Aug 20 09:06:08 PDT 2010


dsimcha <dsimcha at yahoo.com> wrote:

> If we make unused imports an error, how is anyone supposed to do import
> someSmallLibrary.all?  If you make unused imports an error, the  
> collective cost of
> extra import declaration boilerplate will probably be larger than the  
> GDP of some
> African countries.

Only give warnings for this for modules specified on the command-line.
////
module foo;
import bar;
////
module bar;
import unused;
////

dmd foo
   No problem (as long as the compiler magically finds bar)
dmd foo bar
   Warning!


-- 
Simen


More information about the Digitalmars-d mailing list