Re: C# Nullable types
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Thu, 05 Apr 2007 09:12:23 -0700
On Wed, 04 Apr 2007 12:20:48 -0700, Scott M. <s-mar@xxxxxxxxxxxxx> wrote:
Something having an unknown value is not, in any way, related to a
dissussion of null. The very word you use "unkown" implies that there is, in fact, something to "know". A null value indicates the exact
opposite of that, that there is no value at all. That's why I said
that your alaogy was not a good one.
IMHO, you are making a mountain out of a molehill.
The exact meaning of "null" depends on what the designer of the code using "null" intends it to mean. While I do see the difference between something having a price that is not known and something not having a price at all, I see absolutely nothing wrong with someone writing code in which "null" can mean the former. For example, suppose you have a database of products available for sale. You know ahead of time that *everything* has a price. Why in the world would you use "null" to indicate something that has no price? Your set of data would never use the value "null" in that case, and there would be no reason to even use a nullable type.
"Null" means what the code designer says it means. Nothing more, nothing less. Your complaint about the analogy provided is pointless. If someone wants to use a "null" value to indicate that a value is unknown, rather than to indicate that there is no value, what's it to you? How in the world is it so wrong to do so?
When I run into situations where a value is unknown to me, I set up a
variable to capture that value. [...]
And what if according to your definition of "null", your variable will never take on the value "null"? Then you've wasted extra storage for no good reason.
You seem to be discussing what a "nullable type" is, rather than the meaning of "null".
Given that "the meaning of 'null'" is arbitrary, while "what a 'nullable type' is" is not arbitrary, it seems to me that the latter is a more sensible thing to discuss.
Pete
.
- Follow-Ups:
- Re: C# Nullable types
- From: Scott M.
- Re: C# Nullable types
- References:
- Re: C# Nullable types
- From: Patrice
- Re: C# Nullable types
- From: Scott M.
- Re: C# Nullable types
- From: Patrice
- Re: C# Nullable types
- From: Scott M.
- Re: C# Nullable types
- Prev by Date: Re: Shell MegaPack.Net 8.0 Released.
- Next by Date: Re: C# Nullable types
- Previous by thread: Re: C# Nullable types
- Next by thread: Re: C# Nullable types
- Index(es):
Relevant Pages
|