At 03:20 PM 8/17/2003 -0400, Robert Cummings wrote:
There has been a recent thread on the internals list as to the meaning
and usage of the "null" datatype. Zeev claims, perhaps rightly so, the
following:

Zeev wrote:
>
> null is not a value, was never meant to be a value, and won't be a
> value

Interestingly though, the PHP documentation at

http://www.php.net/manual/en/language.types.null.php

indicates the following:

    The special NULL value represents that a variable has no value. NULL
    is the only possible value of type NULL.

Which is obviously contradictory since it claims to be a variable having
no value and yet also claims it is a special value. Also the following
snippet from:

http://www.php.net/manual/en/language.operators.assignment.php

seems to also indicate that null is a value -- namely:

    The basic assignment operator is "=". Your first inclination might
    be to think of this as "equal to". Don't. It really means that the
    the left operand gets set to the value of the expression on the
    rights (that is, "gets set to").

The above reference might not be obvious, but since you can assign the
null constant, then it says the "left operand gets set to the value
of..." seemingly indicating that null is a value.

Now the point of the discussion is not to indicate who is right or who
is wrong -- that would appear to be a ridiculous argument. I am more
interested in finding out the practices and experience of PHP
developers. I'd like to know how many people treat null as a value, and
how many do not. For instance to you ever assign default values of null
to instance variables, or local variable, or array entries? I know in
practice that I have, and find it quite convenient to represent a
default value.

Cheers,
Rob.
--

Year's ago I was told that NULL means "Don't know", and to take it a little further, one could argue that it represents the state of a variable, rather than its contents. Once a concrete value has been assigned, even if it is a space or a zero, the state of the variable is no longer NULL.


I also think, in discussing NULLs, that we hit a limit of language - we have to refer to this "not knowness" as something. Thus a variable set to NULL is not like an empty bucket, more like a bucket with potential, but if you examine it reveals not " " 's, or 0's, but a benign vacuum.

This is not a value, but it is a convenient shorthand to refer to it as such.

Now, shall we discuss imaginary numbers?

Cheers - Miles


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to