Chaim Frenkel wrote:

> >>>>> "GL" == Glenn Linderman <[EMAIL PROTECTED]> writes:
>
> GL> There is a difference between "undefined" and "unknown".
>
> GL> Perl undefined is a different concept--that of an uninitialized
> GL> variable.  This is proven from its earliest versions where the
> GL> value is coerced to 0 or '' (specific values) when used (without
> GL> warnings on).
>
> Sorry, as far as I'm concerned
>
>         $foo = undef
> and
>         select @foo = NULL
>
> Are both initialized.

If you want to believe that, you can, but you will be pushing large rocks uphill
trying to turn undef and NULL into the same concept.

> And what do you consider
>
>         sub foo { ....; return }
>         $status = foo;
>
> Uninitialized? Very clearly initialized.

There is a difference between undefined and uninitialized, too, but Perl clearly
blurs these distinctions by (1) Allowing statements like "$foo = undef" to define
a variable to have the same state as its uninitialized state. (2) Allowing the
coercion of a variable with the "undef" state to be translated to zero or '' when
a number or string is expected, and the variable cannot supply one.  The point is
that while a variable may be reset to the same state as it has when it is
uninitialized via an initialization statement makes the distinction between
undefined and uninitialized impossible to determine.  If the difference is
impossible to determine, then the concepts must be treated the same, even if they
have a difference.  So in Perl, undefined and uninitialized are the same concept,
because they are indistinguishable.  So you can state that after "$foo = undef"
that $foo has been initialized, but I challenge you to write a Perl program
fragment that can be placed after either of the following two Perl program
fragments, and can tell, without reading the source code, which fragment it was
placed after:

Fragment #1:

   ;


Fragment #2:

   $foo = undef;

Either you can't, or I'll learn something signficant about Perl, and the
differences between Perl's concepts of undefined and uninitialized (which may be
different than yours, but if yours differ, they are somewhat irrelevent in
discussions about Perl).

> And lets look at the name and functions
>
>         defined($foo)
>         undef($foo)
>
> Both seem clearly to mean _undefined_ or perhaps unknown or NULL

Both seem clearly to mean _undefined_.  Your sentence is true, because the first
boolean is true--the others are false.

> The use of undef meaning 0 or '' is quite useful.

I won't argue with that, and neither will lots of one-line-script writers.

> But under some programing styles having tristate logic and NULL propogation
> would make some programming task a bit more straightforward.

I fully agree with the above statement.  But with using undef as an overloaded
substitute for NULL I cannot agree.

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

Reply via email to