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.

> 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.

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

> 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.

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>

Reply via email to