Nathan Wiger wrote:
>
> Here's my concern about changing the meaning of undef.
>
> undef has a very well-defined (ha!) Perl meaning: that something is
> undefined.
Here's something you and Glenn don't seem to understand:
it doesn't *matter* what the human meaning of undef is.
Call it undefined, uninitialized, unknown, etc. etc.
What matters is that in the perl machine, it's a different
kind of value that a scalar can have, besides string, number,
reference, filehandle, etc.
The special behavior of undef is implemented in code.
If you want a special value (undef) to have different
semantics, and thus to be treated differently, you do
it in code.
> The concept of
> null does not allow you to do this, because a null value is unknown: it
> may be undef, or 0, or -3.2e14, or "bob", but you *don't know*.
False. Null cannot, by definition, be 0, -3.2e14, or "bob", because
those are not "unknown" values. Put another way,
( "bob" is null )
can NEVER be true.
> ...you are now changing the meaning of fundamental Perl operations.
Yes; that's why it's a lexically scoped pragma.
> You're *still* introducing "yet another state of null",
No, you're only changing the behavior of the operations.
undef is still just undef.
> This is just as dangerous as having a pragma like so:
>
> use 'zeroistrue';
> $num = 0;
> print "Got data" if ( ! $num );
Dangerous? Well, this is perl. Caveat programmor.
--
John Porter
We're building the house of the future together.