Re: Why aren't 'warnings' on by default?

From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 02/19/05


Date: 19 Feb 2005 14:11:24 GMT

Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote in comp.lang.perl.misc:
> Also sprach Anno Siegel:
> > Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote in
> comp.lang.perl.misc:

[unplanned warnings from a module]

> >> Does it mean there's a bug in the module,
> >
> > Yes. See below.
> >
> >> or maybe in my program using
> >> this module? Or maybe it's a potential bug that could occur under
> >> certain rare circumstances. It could just as easily mean nothing of that
> >> kind and only expose the module's author's sloppyness.
> >
> > If a module issues warnings the author didn't intend the user to see,
> > that's a bug. Most of the time it is trivially fixed.
>
> Ah, but there the warning itself becomes the bug. The trivial fix would
> be getting rid of 'use warnings' within the module. No warning, hence no
> bug. ;-)

Taking out "use warnings" doesn't fix the bug -- the user can make it
reappear through -w. You need "no warnings ..." in the right scope.
That scope would rarely be the entire module, but rather the smallest
possible scope that does the job. Or you change the logic so that
the warning doesn't happen in the first place.

> There is obviously something very contorted in this logic just outlined.
> But it is the direct implication of your assertion that a warning
> produced by a module is a bug.

It's less contorted when the fix is as outlined above.

> > If the module author has "use warnings" early in each file as a matter of
> > course, these problems are caught during development. Unfortunately, h2xs
> > issues a module template without warnings. That may be a reason why the
> > practice isn't more common.
>
> I just checked it (again). h2xs puts them in, unless a version older
> than 5.6 is specified using -b or --skip-warnings is mentioned
> explicitly.

You are right. Apparently it has done so since at least 5.6.1. I don't
know what made me think otherwise.

[...]

> >> If warnings in module context really and rightly suggest there's a bug,
> >> then the bug itself will sooner or later manifest in some other way,
> >> wont it? Otherwise it wouldn't be one.
> >
> > What about silently delivering wrong results?
>
> It's not at all clear to me how wrong results correlate with the amount
> of warnings emitted. I will admit that the likelihood of warnings is
> probably higher when a wrong result is being computed (and vice versa).
> However, there will still be many cases where those two things will be
> entirely uncorrelated. If anything, warnings from a module will give me
> doubts about the quality of the module in question.

The warning indicates a case the author hasn't thought of and hasn't
tested. If the results are correct in such cases that's coincidence.

> >> The point being that warnings
> >> rarely provide information useful to people not in charge of the code.
                                                 ^^^
> >
> > Really? I'd understand "(not) useful to the people running the program",
> > but as a developer I'm just as interested in warnings as I am in errors.
>
> I see myself as a plain user when it comes to external modules and...

Sorry. I consistently overlooked a "not" in your sentence. My objection
makes no sense.

Anno



Relevant Pages

  • Re: Why arent warnings on by default?
    ... > Also sprach Anno Siegel: ... >> no reason not to use warnings. ... Or maybe it's a potential bug that could occur under ...
    (comp.lang.perl.misc)
  • Re: lc() with undefined arg
    ... Also sprach Anno Siegel: ... the value is no longer undef but the empty string. ... >> meaning and silently transforming one into the other is wrong. ... When I get warnings about uninitialized ...
    (comp.lang.perl.misc)
  • Re: [PATCH -mm] sys_semctl gcc 4.1 warning fix
    ... I disagree here that it covers up any bug. ... In fact, that wrapper is more ... So if you like to look for real warnings, you can compile it with the ... and have to fight to find the real bugs. ...
    (Linux-Kernel)
  • Re: changed queries save automatically
    ... Not exactly a "tiny" bug is it? ... A query not prompting you about saving it is one of the symptoms of this ... macro or code someone has Set Warnings to Off but forgot to Set ... Compacting and repairing closes the database and reopens it. ...
    (microsoft.public.access.queries)
  • Re: A toughy.
    ... Do I ignore all those warnings and using add and remove just delete the darned thing? ... I have always used HTML for my personal posts and the HTML doesn't seem to ... Bug 2. ... Paying users do not have this message in their emails. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)