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

Ellery Newcomer ellery-newcomer at utulsa.edu
Fri Nov 13 06:36:30 PST 2009


Leandro Lucarella wrote:
> Walter Bright, el 12 de noviembre a las 19:35 me escribiste:
>> Andrei Alexandrescu wrote:
>>> I think this is an environment issue. I like Eclipse's approach.
>>> Java unnecessary imports are underlined with a wavy red line.
>> I agree. I would find it very annoying to have to remove unused
>> imports to get it to compiler. First off, I tend to have "all"
>> imports that import everything.
> 
> That's odd, first you say you think D would be a failure if it needs an
> IDE and now you say that the only way to avoid unnecessary dependencies
> you should rely on an IDE =)
> 
> I really think this should be a compiler feature. Make it a warning then
> (and while you are at it, make it a *real* warning, not a warning-error).
> 
>> Secondly, what if I version out some code, wouldn't want to version the
>> import too.
> 
> Why?
> 

Given the way DMD currently works, such a feature could only say this
import is unused in this version configuration. There's no way to know
if the import is used in a different version configuration, short of
running compiles for every possible one.



More information about the Digitalmars-d mailing list