On Thu, Sep 07, 2000 at 09:18:58PM -0600, Tom Christiansen wrote:
> >What I think might be more interesting or useful would be to have
> >another undef type. Call it uninit. THis would be only used for data
> >that hasn't been initialized. Then there would be two warnings one
> >for unitialized and one for using undef.
>
> Argh, no!
There *is* an internal difference between "never used" and
"undefined". In fact, that's how "exists $array[5]" is implemented
(last I checked).
Despite the groans from the peanut gallery, it might make sense for
the "Use of uninitialized value" warning to be split into two cases,
one for never used, one for undefined (both still being covered by
"use warnings qw(uninitialized)")
Funny thing is, I can't think of a case at the moment where such
information would be useful. I'm also a little worried about
implementing the details of such a propsal. Consider the following...
my $bar;
foo();
foo(undef);
foo($bar);
sub foo {
my($arg) = shift;
print $arg;
}
All of these cases would produce a "Use of undefined value" warning
from print because in all cases, shift returns undef.
I'm thinking the number of cases where you'll actually get a "Use of
uninitialized value" warning (meaning the variable was never set to
anything) would be very low.
--
Michael G Schwern http://www.pobox.com/~schwern/ [EMAIL PROTECTED]
Just Another Stupid Consultant Perl6 Kwalitee Ashuranse
Any failure I encounter in life is the fault of android weasels.
-- everything i ever needed to know i learned from goats