At 10:11 PM 9/19/00 -0700, Nathan Wiger wrote:
>Tom Christiansen wrote:
> >
> > >Currently, Perl has the concept of C<undef>, which means that a value is
> > >not defined. One thing it lacks, however, is the concept of C<null>,
> > >which means that a value is known to be unknown or not applicable. These
> > >are two separate concepts.
> >
> > No, they aren't.
>
>Uhhh, yes, they are... [snip]
>The keyword C<null> means that a value is B<known to be unknown>. This
>means a couple important things, with semantics far different from
>C<undef>:
>
> 1. Any math or string operation between a null and
> non-null value results in null
>
> 2. No null value is equal to any other null, unlike
> undef
>
> 3. A null value is neither defined nor undefined
I repeat, why do you want to do this in Perl? It makes perfect sense for
these rules to apply in SQL, but that is a far different language from
Perl. SQL is an implementation of the relational calculus, Perl is an
imperative language. The propagation of NULLs in query expressions is
necessary to give meaningful query semantics; what does this have to do
with how expressions are used in Perl?
>To recap: There is no 1:1 mapping between C<undef> and <null>. Any
>attempt to do so is inaccurate. For more details, please read the
>references.
>
>=head1 REFERENCES
>
>http://www.sitelite.nl/mysql/manual_Problems.html#IDX666
>
>http://www.unb.ca/web/transpo/mynet/mtx19.htm#r2
These references talk only about the meaning of NULL in a relational
database. I cannot see how they support your position at all. They say
nothing about why such an entity would be of any use in any other language.
SQL weirdness of the week: I just had a program that formed a "WHERE foo IN
(LIST)" clause fail because the LIST was empty. You'd think that it would
do the sensible thing and return a null set (there's that wretched word
again), but no, it's an error. Even more bizarre, I cured it by setting
the clause to "WHERE foo IN (NULL)". You'd think that would be the same as
"WHERE foo IS NULL", but noooo, we're talking about SQL here. (At least
the Oracle brand of it.) Let's not venture one inch down that path.
--
Peter Scott
Pacific Systems Design Technologies