Warn on unused imports?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Mon Oct 1 20:58:04 UTC 2018


On Monday, October 1, 2018 2:44:32 PM MDT Nick Sabalausky (Abscissa) via 
Digitalmars-d wrote:
> On 10/01/2018 03:32 PM, Jonathan M Davis wrote:
> > On Monday, October 1, 2018 12:36:49 PM MDT Nick Sabalausky (Abscissa)
> > via
> >
> > Digitalmars-d wrote:
> >> Yes, that's exactly what warnings are for. If people need to treat them
> >> differently than that (ex: C++), that's a failing of the language.
> >
> > As soon as warnings are part of the build process,
>
> Nobody said anything about making them part of the build process. We're
> talking about them being included in the compiler, not about them being
> in the build process. Please don't move the goalposts.

dmd -w

and

dmd -wi

build your program. Printing warnings is part of the build process.

> >> Plus, other warnings (like deprecations, for example) which have proven
> >> extremely helpful would have been a major problem had they been
> >> outright
> >> errors.
> >
> > Technically, deprecations aren't warnings, and dmd treats them quite
> > differently. They aren't affected by either -wi or -w, and from a
> > semantic perspective, they're completely different.
>
> That is purely playing around with word semantics. Deprecations in DMD
> are a non-fatal message about something that might need fixed sooner or
> later. That is what a warning is. Implementation details do nothing to
> change that.

Deprecations are fundamentally different from compiler warnings. In the case
of a deprecation, your code _will_ break if you don't change it once the
deprecation period ends, whereas a compiler warning is just telling you
about something that the compiler thinks might be wrong wiith your code. In
some cases, it's right; in some cases, it's wrong. In the case of
deprecations, it's always right, and you always have to change your code.
You just don't have to change it immediately.

- Jonathan M Davis





More information about the Digitalmars-d mailing list