Jonathan M Davis:

And in the case of unused variables, it would completely break Phobos, because so many traits legitimately use unused variables.

Given how important is to spot unused variables in user code, then maybe some solution can be invented for library code that has legitimate uses of unused variables, like creating a built-in attribute to mark an unused variable that the compiler will not report as unused. Like @used, a bit like "used" function attribute of GCC:

used
This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function
    is referenced only in inline assembly.

Bye,
bearophile

Reply via email to