Wish: Variable Not Used Warning

Nick Sabalausky a at a.a
Wed Jul 9 10:12:49 PDT 2008


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:g51uc7$1let$1 at digitalmars.com...
> Nick Sabalausky wrote:
>> It sounds like (previously unknown to me) there's a rift between the 
>> reality of warnings and the perceptions that many programmers (excluding 
>> us) have about warnings. As I understand it, you consider it more 
>> important to design around common perceptions of warnings, even if 
>> they're mistaken perceptions (such as warnings, by definition, not 
>> actually being errors). My disagreement is that I consider it better to 
>> design around the realities, and use a more education-based approach (I 
>> don't necessarily mean school) to address misperceptions. Is this a fair 
>> assessment of your stance, or am I still misunderstanding?
>
> It's a fair assessment. I give more weight to designing a language around 
> the way programmers are and the way they tend to work, rather than trying 
> to force them adapt to the language.
>

The way I program, I tend run into situations such as the two Koroskin Denis 
pointed out. Unless this hypothetical D lint tool actually ends up 
materializing, then I'm forced to adapt to a compiler that refuses to let me 
know about a condition that I *want* to know about.

Someone else in this thread just mentioned that DMD's warnings are always 
treated as errors, instead of only being treated as errors with a "warnings 
as errors" switch. I wasn't aware of this. That approach *certainly* 
confuses the issue of "warning" vs. "error" and creates what are effectively 
multiple languages (and, as other people pointed out, makes such 
"'warnings'-but-not-really-true-warnings" useless when using outside source 
libraries).

(If you're wondering how I could have not known DMD treats warnings as 
errors since I'm obviously so pro-warning that I would certainly be using 
the -w switch, it's because at the moment, I seem to be having trouble 
getting DMD 1.029 to emit any warnings, even when deliberately trying to 
trigger the ones it's supposed to support. *But* for all I know right now 
this may be a rebuild or IDE issue, I haven't had a chance to look into it 
yet.)

> As for the needs of programming managers, I think D is the only language 
> that has attempted to address those needs. At least I've never ever heard 
> of any other language even acknowledge the existence of such needs.

If there's a legitimate need that programming managers have that can be met 
by a compiler without creating any problems for the actual programmers, then 
I'm all for it.

But when there's a "programming manager" that's steadfast about "all 
warnings must always be treated as errors", *BUT* refuses to be practical 
about it and entertain any notion that there may actually be some warnings 
that are NOT really problems (in other words, "delusional" by the very 
definition of the word), then said "programming manager" is clearly 
incompetent and by no means should be indulged. That's like creating a 
programming language where 2 + 2 equals 7, just because you find out that 
there are "programmers" who are incompetent enough to insist that 2 + 2 
really does equal 7.





More information about the Digitalmars-d mailing list