Russ Allbery wrote:

> Glenn Linderman <[EMAIL PROTECTED]> writes:
>
> > undef has the following semantics:
>
> > 1) all otherwise uninitialized variables are set to undef
>
> And as the RFC says, quite a few times, for database code you often want
> all your variables to start as the null value.

The RFC suggests that, but I never said that.  I'd actually like them to start
as undef, until such time as I get around to copying values from a database
into them.  Then undef can still indicate that the variable is not yet
defined; has not even been set to a value such as null, yet.

> > 2) under "use strict", use of undef in expressions is diagnosed with a
> > warning
>
> And use of null in an expression would be diagnosed by getting null in the
> output.  If you keep them as separate concepts, at this point you're
> screwed if that was a bug and you don't know where the null crept in.  If
> you keep them the same, you just turn off the pragma for that section and
> see where you get the warning.

Nulls don't creep in.  As stated above, uninitialized variables would still be
undef, and that is convenient.

> Keeping them the same lets you turn this warning on selectively for
> database code, which could be a significant aid in debugging.

print works fine, too.

> > 3) undef is coerced to 0 in numeric expressions, false in boolean
> > expressions, and the empty string in string expressions.
>
> > The semantics for NULL is different, read the SQL standard.
>
> The semantics of undef can be chosen by the programmer.  My point is that
> if the undefined value called "undef" and the undefined value called
> "null" behave differently in Perl, *that* would be a serious bug in my
> opinion.  Talk about horribly confusing.

If they are the same, then you can't tell the different between a variable
that is yet uninitialized, and one that has been read in from the database,
containing a NULL.  In my mind, that is horribly confusing.

--
Glenn
=====
Even if you're on the right track,
you'll get run over if you just sit there.
                       -- Will Rogers





____________NetZero Free Internet Access and Email_________
Download Now     http://www.netzero.net/download/index.html
Request a CDROM  1-800-333-3633
___________________________________________________________

Reply via email to