Allow me to throw another log on the fire:

    my $x;
    if (something)
    {
        $x = 1;
    }
    my $y = $x;
    
This would give a compile-time warning under your RFC, warning the
user of a possibly uninitialized $x. Okay. Next:

    my $x;
    if (something)
    {
        $x = 1;
    }
    else
    {
        $x = 2;
    }
    my $y = $x;
    
Would this give the same warning? Would it notice that $x is set
in both branches of the condition?
Worse:

    my $x;
    if (something)
    {
        $x = 1;
    }
    if (!something)
    {
        $x = 2;
    }
    my $y = $x;

I presume this would generate a warning under your RFC, right?
Since I would guess the compiler shouldn't be required to notice
that one condition is the inverse of the other?
I'm not sure I like the above construct not behaving identically
to the second case (if...else...) above...

Moving on:

    my $x;
    if (thing1)
    {
        $x = 1;
    }
    elsif (thing2)
    {
        $x = 2;
    }
    elsif (thing3)
    {
        $x = 3;
    }
    else
    {
        $x = 4;
    }
    my $y = $x;

Warnings, or no?

How about:

    my ($x, $i);
    for ($i=0; $i<10; $i++)
    {
        $x .= $i;
    }
    my $y = $x;

Now, I can look at that and see that $x will be '0123456789', but
the compiler can't be expected (imho) to know whether the loop
condition will ever execute, so under your RFC it will generate a
"possibly uninitialized" warning, right?

 ----------------------------------------------------------------------
 Eric J. Roode,  [EMAIL PROTECTED]           print  scalar  reverse  sort
 Senior Software Engineer                'tona ', 'reh', 'ekca', 'lre',
 Myxa Corporation                        '.r', 'h ', 'uj', 'p ', 'ts';

Reply via email to