>But that doesn't even matter that much here; I'm saying that if the
>compiler can definitely determine that you are using an uninitialized
>variable, it should warn. 

...

>$x is a global. The compiler cannot detect all possible assignments to
>or accesses of globals, so it never warns about them.

>If you inserted my $x at the top of that code, it would most likely
>produce the "possible use" warning. Or not; this is a simple enough case
>that it might be able to infer the right answer.

>I am certainly not saying that the "possible use" warning should be
>enabled by default. But please, argue over that one separately from the
>others. It's the most likely to annoy.

>> Or:
>>     foo();
>>     print $x;
>> 
>> Generate a warning, or not?  Which one? Remember, foo() may initialize $x.

>Same thing. If $x is lexical, it gives a definite warning. If $x is a
>global, it says nothing. You're right; I need to point this out in the
>RFC.

Careful:

    sub ouch {
        my $x;
        my $fn = sub { $x++ };
        register($fn);
        print $x;
    } 

--tom

Reply via email to