Detector for unused variables

Timon Gehr timon.gehr at gmx.ch
Wed Aug 1 08:07:31 PDT 2012


On 08/01/2012 12:38 PM, bearophile wrote:
> Regan Heath:
>
>> Indeed. IIRC Walter's rationale on things like this has always been
>> that they belong in 3rd party tools.
>
> Walter is not always right.
>
>
>> It's why the DMD front end is available for use, so people can create
>> tools like this, syntax highlighters, re-formatters, dependency tree
>> diagrams, or... you name it.
>
> Detecting unused variables is a core feature,

No. This mustn't be part of the language.

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

> it belongs in the
> compiler, like compile-time array bound tests and other errors currently
> detected by DMD. This allows everyone to use it with minimum work, so
> everyone enjoys it, and it requires less work to be implemented because
> the compiler already does lot of analysis.
>

It is not an error. Making things that are not errors illegal is prone
to introduce bugs into code using __traits(compiles).

This can be a warning at best.


More information about the Digitalmars-d-learn mailing list