Tom Christiansen wrote:
> Perl has *one* out-of-band value. It doesn't need more. That
> doesn't mean that perhaps some rare sorts of programming might not
> benefit from fancy weirdnesses. That's what modules are for.
> You don't need to complicate the general language to get what
> you want. Don't make others pay for your problems.
If it can be built with reasonable performance out of other mechanisms, I'm not
against that. Just tell me how. I don't claim to know everything about Perl, just
because I use it a lot.
> >1) all otherwise uninitialized variables are set to undef
>
> Wrong. You cannot say that an aggregate is undef. Scalar
> variables--not all variables, just scalar variables alone--hold the
> uninitialized value, henceforth known as the anti�initialized value,
> if they were last initialized to the anti�initialized value, or if
> they haven't been initialized at all--in which case, I suppose, you
> *might* choose to call it _a_n_t_e�initialized instead of anti�initialized,
> but then you'll get people wanting to split those up again.
OK, scalar variables. But I see code in the XML modules that check defined (@array)
...
> >2) under "use strict", use of undef in expressions is diagnosed with a warning
>
> Wrong. You are thinking, perhaps, of `use warnings', not `use strict'.
> In particular,
>
> use warnings qw'uninitialized';
Yep, thanks for the correction.
> >3) undef is coerced to 0 in numeric expressions, false in boolean expressions,
> >and the empty string in string expressions.
>
> I'm not happy with your use of "coerce". There's no mutation. It simply
> *is* those things.
Fine. So, in particular, it _isn't_ null.
> 4) The anti�initialized value is autovivified to a true value when
> used that value is (legally) used lvaluably.
If, by "true value" in the above, you mean a value other than undef which would be
interpreted as boolean false, then I think I understand what you said. But not well
enough to have said it, which is why I used coerce.
> Notice also this:
>
> % perl -le 'use warnings; $a = 1 == 2; print $a->[1] ? "good" : "bad"'
> bad
>
> % perl -le 'use strict; $a = 1 == 2; print $a->[1] ? "good" : "bad"'
> Can't use string ("") as an ARRAY ref while "strict refs" in use at -e line 1.
> Exit 255
Interesting. I learn something every day. Today, you helped. Maybe you can help
some more... implement me an SQL null, that can coexist with Perl undef, not replacing
it.
--
Glenn
=====
Even if you're on the right track,
you'll get run over if you just sit there.
-- Will Rogers
_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html