On Wed, 01 Aug 2012 15:52:22 +0100, bearophile <bearophileh...@lycos.com> wrote:
Regan Heath:

If you make detecting un-used variables a /requirement/ for implementing a D compiler, you make it that much less likely someone will write one,

Detecting unused variables can be written as a part of the front-end.

Or it can be written using the front-end.

It's meant to be shared by LDC and GDC that use the same front-end.

Why?

We may have gotten used to it being there, but it's not part of the "compilation" phase but rather part of the "development" phase and/or the "quality control" phase which are arguably the realm of the IDE or a "lint" checker.<

In theory you are right, in practice I don't know how much this idea is applicable to D/DMD and how much good it does. In Clang they have added a switch to perform extra static tests on the code. It's a feature built in the compiler. I think this is an acceptable place to put an unused variable warning in DMD.

You're missing my main point which is that you can get the appearance of a compiler feature with a 3rd party tool bundled with the compiler, the difference/benefits of a 3rd party tool are:

1. The "feature" it implements is not a requirement for all D compilers.
2. Walter doesn't have to implement it.

And more minor points include:

3. We can have competition between 3rd party vendors.
4. People can select/run their favorite tool.
5. A crashing tool/feature will no stop compilation.

Basically, having a 3rd party tool will look exactly like a feature of the compiler, but it will be better for the reasons above.

R



Reply via email to