On Wed, Sep 20, 2000 at 05:20:54PM -0700, Steve Fink wrote:
> >     $foobal = 3;
> >     if (@ARGV) {
> >         $foobar = @ARGV;
> >     }
> > 
> >     print $foobar;
> > 
> > Only warn me that $foobar is uninitialized?  I always prefer it when the
> > actual source of my problem is pointed out, rather than its symptoms.
> 
> It's exactly the same behavior as now, if you add in the "maybe it's a
> typo?" guess. Which sounds fine to me.

Except for the line number reported, which is the important part.


> Something that isn't defined() means that either nobody bothered to
> assign a value to it, or somebody took away its value.

I think of undef as a value in and of itself, not simply a state of being. 
A value that has magical properties, and that is recognized in various
places, but a value nonetheless.  Perhaps I've been corrupted by the
implementation (or what I understand of it), but there it is.

 
> With my style of programming, my($foo,$bar,$blah) would rarely trigger
> warnings, because I would do something with those variables before using
> them. I rarely use defined() to mean "if the control has happened to
> take a route that never affected the values of this variable". In those
> cases, I wouldn't mind using an explicit undef.

I would.  I have not done it personally, but I do maintain code that has
something along the lines of:

my($foo, $bar, %baz, @qux, $quux, $blah ... ad nauseum);

This new warning would make life difficult for me.

 
> It sounds like your style of programming is different. So you wouldn't
> enable those warnings. And also that you find the existing warning
> useful, which means the control over the warnings must be more
> fine-grained than all or nothing. Sounds reasonable to me. And you might
> want to temporarily turn on full warnings mode, ignore the spurious
> messages, fix the bugs uncovered, and turn the warnings back off.

If your warning is optional, turned on by an explicit use warnings call, and
not included in its default set, I'm fine with it.


> But do you like the feature of C where it warns you at compile time when
> this is going to happen?

Yes, and Perl currently has the very same thing, except with the additional
warning when I use a variable that has not been declared.  This being Perl,
it's natural; you cannot use a variable in C without declaring it, so the
issue never comes up.

 
Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to