develooper Front page | perl.perl5.porters | Postings from February 2011

inherent problem with fatal warnings

Thread Next
From:
Tom Christiansen
Date:
February 21, 2011 10:01
Subject:
inherent problem with fatal warnings
Message ID:
5009.1298311274@chthon
There's a problem with 

    use warnings FATAL => "all";

The problem is that it causes the compiler, not just the interpreter, 
to abort on the *first* warning.  This is a problem because it make syntax
errors simply impossible to find.  

For example, if under 

    use warnings FATAL => "all";

I randomly change a comma in a hash init to a letter, I get this:

    % perl -wc /tmp/rrx
    "my" variable $b masks earlier declaration in same scope at /tmp/rrx line 49.
    Exit 255

And that's it; nothing more!  But with 

    use warnings; 

I get the altogether differnet:

    % perl -wc /tmp/rrx
    "my" variable $b masks earlier declaration in same statement at /tmp/rrx line 49.
    "my" variable $a masks earlier declaration in same statement at /tmp/rrx line 49.
    "my" variable $a masks earlier declaration in same statement at /tmp/rrx line 51.
    "my" variable $b masks earlier declaration in same statement at /tmp/rrx line 51.
    "my" variable $a masks earlier declaration in same statement at /tmp/rrx line 53.
    "my" variable $b masks earlier declaration in same statement at /tmp/rrx line 53.
    "my" variable $a masks earlier declaration in same statement at /tmp/rrx line 55.
    "my" variable $b masks earlier declaration in same statement at /tmp/rrx line 55.
    "my" variable @rex masks earlier declaration in same scope at /tmp/rrx line 56.
    Global symbol "$entryl" requires explicit package name at /tmp/rrx line 40.
    syntax error at /tmp/rrx line 40, near "$entryl
	    SCORE"
    syntax error at /tmp/rrx line 44, near "}"
    Global symbol "@srex" requires explicit package name at /tmp/rrx line 60.
    /tmp/rrx had compilation errors.

It is trivial to show many many other cases like this.  The evillest is
"use of uninitialized value" killing the compiler.  It's really wicked.

Shouldn't fatality of warnings be delayed until CHECK/UNITCHECK time, 
or something like that?

--tom

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About