Wish: Variable Not Used Warning
Nick Sabalausky
a at a.a
Wed Jul 9 21:35:26 PDT 2008
"superdan" <super at dan.org> wrote in message
news:g53ms5$h6n$1 at digitalmars.com...
>
> group was given as an example. the thing is it has become clear to the
> luminaries that invoking better education is not an answer. it is clear
> from the literature and also from c++ oh ecs.
>
>
[rambling, barely-readable cuss-fest trimmed]
>
> once i stop bitching i get a clearer mind and I get to write some shit
> like this.
>
> void vacuouslyUse(T)(ref T x) {}
>
> void foo()
> {
> int crap;
> vacuouslyUse(crap);
> ................
> }
>
> use and remove as you wish.
>
> unused name should be an error. if you want to not use something, you must
> sweat a little. vacuouslyUse fits the bill exactly. should be in phobos.
I would still prefer it to be a warning (that way it would keep nagging me
when I forget to finish up and take out the temporary vacuouslyUse), but at
this point I could live with this compromise. It would certainly be a lot
better then the total silence it gives me now.
>
> it works but i kinda doubt you'll be all for it. you don't want to solve
> the unused variable problem. you want compiler warnings. somehow you'll
> work your argument out to make my solution undesirable.
>
>
> this is an imperfect world. i see value in the no warning stance. you
> don't see.
I see value in warnings, you don't see. The imperfect world fact only serves
to illustrate that taking sound practical advide ("the need for warnings
should be minimized") to a unilateral extreme ("all warnings are always
bad") just doesn't typically work out. Remember when the Java folks were
trying to tell us that nothing should ever be non-OO?
> therefore when competition in d compilers arena will pick up i'd see a
> warning as a shitty concession, while you will grin "i told ya all along".
>
I'm well aware of the difference between truth and popular opinion.
>> Designing everything to fit into a compiles/errors dichotomy is great, in
>> theory. But in practice it's just unrealistic. Even Walter ended up
>> having
>> to add a few "warnings" to D (even if he implemented them more as
>> optional
>> errors than as true warnings). Which is why, as I was saying in the
>> beginning, trying to eliminate the need for a specific warning is great -
>> *if* it actually pans out. But that doesn't always happen.
>
> when doesn't it happen?
>
As just a few examples:
http://www.digitalmars.com/d/1.0/warnings.html
>>
>> Anything like that can be attached to an optional command-line parameter
>> that defaults to "off". Problem solved.
>
> weak argument. a good program does some shit and does it well. i'm pissed
> that emacs can browse the web already, alright?
Trying to convince a Unix-hater of something by appealing to Unix-values is
kinda like using the bible to convince an athiest of someting. But, I'm well
aware that debating the merits of Unix-philosophy to a Unix-fan is equally
fruitless, so I'm going to leave this particular point at that.
More information about the Digitalmars-d
mailing list