C# Nullable types

This is a discussion on C# Nullable types within the Framework and Interface Programming forums in category; "Jon Skeet [C# MVP]" <skeet @ pobox.com> wrote in message news:MPG.207f75c61d7b899198da91 @ msnews.microsoft.c om... > Scott M. <s-mar @ nospam.nospam> wrote: >> By the way, Wikipedia says that null is a language-specific keyword, not >> a >> value. Oh yes, Wikipedia also listed the comedian "Sinbad" as being dead >> last month. He is very much alive. You would do well not to use >> Wikipedia >> as a source of fact. > > While you continue to give vague "most people know" as your source? Because I'm being pragmatic and you are (as I've often said about you) splitting ...

Go Back   Application Development Forum > Framework and Interface Programming

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #51  
Old 04-05-2007, 06:45 PM
Scott M.
Guest
 
Default Re: C# Nullable types


"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.207f75c61d7b899198da91@msnews.microsoft.c om...
> Scott M. <s-mar@nospam.nospam> wrote:
>> By the way, Wikipedia says that null is a language-specific keyword, not
>> a
>> value. Oh yes, Wikipedia also listed the comedian "Sinbad" as being dead
>> last month. He is very much alive. You would do well not to use
>> Wikipedia
>> as a source of fact.

>
> While you continue to give vague "most people know" as your source?


Because I'm being pragmatic and you are (as I've often said about you)
splitting uneccesary hairs. This boils down to trivial "it depends on what
the meaning of "is" is stupidity.

Ask someone (a real world developer) what the value of null is and they will
respond exactly the way you just did to my other post, they'll say nothing.

>
> Do you have anything against my *main* source, namely the C# language
> specification which clearly indicates that null is a value?


I've already addressed my problem with calling null a value. Are you
seriously telling me that you have never run into documentation that is
inaccurate or uses a word incorrectly?

My problem is with your unrelenting parsing of words to get to a point
where the other person in the conversation is worn out by your semantics
that don't really pertain to the real world.

You've proven to me (again) that there is no such thing as a reasonable
conversation, so back on the filter list you go.

Bye Jon.



>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too



Reply With Quote
  #52  
Old 04-05-2007, 07:35 PM
Peter Duniho
Guest
 
Default Re: C# Nullable types

On Thu, 05 Apr 2007 13:25:24 -0700, Scott M. <s-mar@nospam.nospam> wrote:

> [...]
>> You are using the word "meaning" in an arbitrarily different way thanI
>> am. The "meaning" of "null" as I am describing it is EXACTLY THE SAME
>> as what the coder using the "null" value to indicate and has ABSOLUTELY
>> NOTHING to do with the way that the language defines or implements a
>> "null" value.

>
> I don't think you know what the words arbitrary, meaning and use are
> because your statements make absolutely no sense.


Perhaps you should get a dictionary then. I doubt anyone else has
anything trouble understanding what I wrote. (I did accidently leave out
a word, but that's not what you're complaining about and I doubt it
interferes with anyone actually reading the paragraph understanding it).

> [...] Saying that nulls =
> unknowns is wrong, plain and simple. Saying that you can intialize a
> variable as null for a value that will be determined later is a perfectly
> good example of how and why one might initialize something as null, but
> it is not a definition of null.


You're the only one restricting this discussion to the "definition" of
null. It was clear from Patrice's post that he was providing an example
of how one would USE a nullable type or a null value. That is, the
"meaning" of a null value _in code_. He never wrote that he was
"defining" null, nor is there anything in his post that ought to suggest
that he was.

There is nothing wrong with his analogy, and your insistence on saying
that there is rather than simply apologizing for your misunderstanding of
his post adds absolutely zero to anyone's understanding of what a nullable
type is or how it might be used.

Pete
Reply With Quote
  #53  
Old 04-05-2007, 09:12 PM
Scott M.
Guest
 
Default Re: C# Nullable types

> I don't think you know what the words arbitrary, meaning and use are
> because your statements make absolutely no sense.


>Perhaps you should get a dictionary then. I doubt anyone else has
>anything trouble understanding what I wrote. (I did accidently leave out
>a word, but that's not what you're complaining about and I doubt it
>interferes with anyone actually reading the paragraph understanding it).


Now you are just being absurd. You really need me to tell you what
arbitrary means? Ok, take a look at this:

http://www.m-w.com/dictionary/arbitrary

I'll say it again and try to read and understand this before you just try to
dispute it:

"The meaning of "null" is not now, nor has it ever been
arbitrary, the "use" of nulls, yes, the "meaning", no."

Did you catch that last part? It goes to the point that you and Patrice are
talking about something different than what the OP asked and to which I have
been correcting you about. You are talking "usage" (context), I am talking
"meaning" (defintion). If yiou really are going to argue this, then you
need to buy one of those dictionaries when you are at their web site,
because now you just are making up definitions for English words as well as
programming terms.

> [...] Saying that nulls =
> unknowns is wrong, plain and simple. Saying that you can intialize a
> variable as null for a value that will be determined later is a perfectly
> good example of how and why one might initialize something as null, but
> it is not a definition of null.


I'm sorry but there is nothing in that statement that is accurate or
informative. Let's see:

> You're the only one restricting this discussion to the "definition" of
> null.


Really? Hmmm, here's a direct quote from the OP: "what is actually a
null value". So, your first remark is incorrect and it's why I've been
correcting Patrice all along. The OP did not ask for potential usages of
null.

> It was clear from Patrice's post that he was providing an example of how
> one would USE a nullable type or a null value.


Yes, I agree and if you took the time to read the thread, you'd see that
this is EXACTLY what I have been saying all along. It does not, however,
answer the OP, hence my replies. So this statement is really irrelevant to
the topic.

> That is, the "meaning" of a null value _in code_.


No, the meaning is the definition. To use your own words, a "USE" was
provided, not a meaning. In a spelling bee, the word to be spelled is used
in a sentence to give the contestant some context, it is not defined (with
one exception when a word has more than one homonym). This *may* be enough
to understand what the word *means* (its definition), but it also may not.
Usage != definition.

> He never wrote that he was "defining" null, nor is there anything
> in his post that ought to suggest that he was.


What thread have you been reading? Since the very first time I pointed out
that he was providing a usage, rather than a definition, he's countered that
his explantion is the correct way to answer the OP (which, in case you
forgot was "what is actually a null value").

>There is nothing wrong with his analogy, and your insistence on saying
>that there is rather than simply apologizing for your misunderstanding of
>his post adds absolutely zero to anyone's understanding of what a nullable
>type is or how it might be used.


What part of null means "no value" did you not get? The OP didn't ask for
how a nullable type might be used. Are you reading your own bull as you
write it?

If you can't see that I have understood his posts from the go, and simply
been trying to tell him what you, yourself just pointed out, then I'm afraid
it is you that has a misunderstanding of this thread. It's obvious you've
jumped in here in the middle and not read the whole thread. I won't hold my
breath though for your apology.




Reply With Quote
  #54  
Old 04-06-2007, 02:18 AM
Jon Skeet [C# MVP]
Guest
 
Default Re: C# Nullable types

Scott M. <s-mar@nospam.nospam> wrote:
> > While you continue to give vague "most people know" as your source?

>
> Because I'm being pragmatic and you are (as I've often said about you)
> splitting uneccesary hairs. This boils down to trivial "it depends on what
> the meaning of "is" is stupidity.


No - the difference between an unassigned variable and one with a value
of null is *not* trivial. It's important to understand, *and* it makes
talking about the rest of the lanugage simpler.

> Ask someone (a real world developer) what the value of null is and they will
> respond exactly the way you just did to my other post, they'll say nothing.


I would hope many would say that it's a reference value which doesn't
reference any object.

> > Do you have anything against my *main* source, namely the C# language
> > specification which clearly indicates that null is a value?

>
> I've already addressed my problem with calling null a value. Are you
> seriously telling me that you have never run into documentation that is
> inaccurate or uses a word incorrectly?


So you're claiming that the C# spec, the Java spec and the C++ spec are
all "wrong" (despite the fact that they get to define how terminology
is used for their own languages), but *your* definition, which you
haven't provided any references for, is the absolute truth.

> My problem is with your unrelenting parsing of words to get to a point
> where the other person in the conversation is worn out by your semantics
> that don't really pertain to the real world.
>
> You've proven to me (again) that there is no such thing as a reasonable
> conversation, so back on the filter list you go.


My "unrelenting parsing" is merely trying to stick to the spec. I'm not
unhappy that you're filtering me out, however - apart from anything
else, the ad hominem attacks get somewhat wearing.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Reply With Quote
  #55  
Old 04-06-2007, 08:47 AM
Patrice
Guest
 
Default Re: C# Nullable types

Well no. This is actually the same as Patrick here in France. The feminim
form for us is Patricia.

"Rory Becker" <RoryBecker@newsgroup.nospam> a écrit dans le message de news:
b0ac48a0838e8c945e37bdb4550@msnews.microsoft.com...
>>> If you don't know the value, you don't know it is 27 so you'll have
>>> a "null" value anyway as you can't do better....
>>>

>> NO! Stop right there. That is false! Just because I don't know the
>> value doesn't mean it can't have a value (like 27). Variables are
>> great examples of holders of potentially unknown values, that doesn't
>> make all variables null does it?

>
> Sorry Scott. I don't think you understand what Patrice is trying to say.
>
> (In fairness, I can't guarentee that I do either but according to my
> interpretation, she's making sense. (erm that is a femanine name where you
> come from? Right Patrice? I don't want to be insulting anyone This
> thread's heated enough already. )
>
> The way I see it, Patrice is trying to explain a valid use of null and
> therefore a meaning which is appropriate for it.
>
> When Patrice says "If you don't know the value, you don't know it is 27",
> she means....
>
> If you don't tell the computer that you have 27 apples then this fact is
> unknown to the computer. This does not stop you from actually having the
> 27 apples though. As Patrice says, the best you can do is null (reasonably
> taken in this circumstance to mean 'unknown')
>
> You could decide to tell the computer that you have 27 apples or you could
> not.
>
> If you do not then the value would be null. (rather than 0 which most
> people would agrees represented the "solid fact of there being no apples
> at all)
>
> Therefore the null represents an as yet unknown or unspecified value.
>
> To put it another way. If the computer tells you "it has 'null' apples",
> what would any reasonable programmer taken that to mean. what would you
> take it to mean.
>
> Another good example could be a company with employees. you could
> (Please excuse the VB here but I'm quicker using it and there are only
> reference types in this example so initialising to null shouldn't be a
> contraversial point here)
>
> -------------------------------------------------------------
> Class Company
> Private mCompanyName as String
> Public Employees as Collection(Of Employee) Public Sub
> New(CompanyName as String)
> mCompanyName = CompanyName
> End Sub End Class
> -------------------------------------------------------------
>
> After construction, an object of type company, would be a (very
> incomplete) representation of a company in the real world.
> In the real world, the company might have 5 or 100 Emplyees.
>
> This information doesn't exist for the class yet and can it be reasonable
> stated that it is unknown to the class.
>
> However, we have not given an empty collection which might be interpreted
> as inticating the "solid fact" that the company has 0 employees.
>
> This is the use of null to mean that we do not know the correct value or
> that it is as yet not available to us(perhaps because a lazy load has not
> yet taken place or perhaps because the database record from which this
> data might have been drawn did not specify for this particular company.
>
> This is a common interpretation of the "meaning" null.
>
> As someone indicated earlier in this thread, the meaning of "meaning" is
> subject to interpretation (sorry for going a little bit meta).
>
> We can interpret as I have above or we can interpret as if the use wanted
> to know the strict definition of null.
>
> I feel that Patrice has the correct interpretation of the original
> poster's intention.
>
> The original posters question is best answered (IMHO) by indicating how
> one might usefully use a null.
>
> The truth is that nobody should care whether a variable was assigned null
> or whether it was null by virtue of not having ever been set.
> This is because after either of these 2 events has occurred, noone can
> tell which did cause it.
>
> At this point "unassigned" becomes the same as "assigned null"
>
> You can be as picky as you like and refer back to the specification as
> much as you like.
>
> Despite the fact that internally c#(and many other languages) represent
> null as a special yet constant value (so that (null = null) is true...
> ... Nobody cares what that value is (whether it is or is not a value). the
> real crux of the matter is "what is it used for?", "how is it useful?" or
> "what did the programmer of this code mean when (s)he used it?"
>
> Ok that was a lot to type and I think I've repeated myself a lot. I have
> not tried to insult anyone, so if you do feel as if I have then I'm sorry.
>
> Either way.... Tag.... you're all IT :P
>
> [BTW... "IT" is a special constant value (whose internal value we don't
> really care about) which when applied to an individual or group,
> designates them to be the person whose turn it is.]
>
> Sorry couln't resist
>
> --
> Rory
>
>
>



Reply With Quote
  #56  
Old 04-06-2007, 08:49 AM
Patrice
Guest
 
Default Re: C# Nullable types

Got it now but I give up anyway to understand what you thought that the OP
just wanted a definition without being interested in how he could use it...

Bye.


"Scott M." <s-mar@nospam.nospam> a écrit dans le message de news:
ua$DSU8dHHA.4688@TK2MSFTNGP04.phx.gbl...
> Rory,
>
> I get what she is saying, but she is not getting my reply. As you state,
> she is giving *uses* for null, not a definition of null. This has been my
> whole point with her posts. I never said her example of the usage of null
> was wrong, I said it was wrong to hold the usage up as a definition,
> that's all.
>
>
> "Rory Becker" <RoryBecker@newsgroup.nospam> wrote in message
> news:b0ac48a0838e8c945e37bdb4550@msnews.microsoft. com...
>>>> If you don't know the value, you don't know it is 27 so you'll have
>>>> a "null" value anyway as you can't do better....
>>>>
>>> NO! Stop right there. That is false! Just because I don't know the
>>> value doesn't mean it can't have a value (like 27). Variables are
>>> great examples of holders of potentially unknown values, that doesn't
>>> make all variables null does it?

>>
>> Sorry Scott. I don't think you understand what Patrice is trying to say.
>>
>> (In fairness, I can't guarentee that I do either but according to my
>> interpretation, she's making sense. (erm that is a femanine name where
>> you come from? Right Patrice? I don't want to be insulting anyone This
>> thread's heated enough already. )
>>
>> The way I see it, Patrice is trying to explain a valid use of null and
>> therefore a meaning which is appropriate for it.
>>
>> When Patrice says "If you don't know the value, you don't know it is
>> 27", she means....
>>
>> If you don't tell the computer that you have 27 apples then this fact is
>> unknown to the computer. This does not stop you from actually having the
>> 27 apples though. As Patrice says, the best you can do is null
>> (reasonably taken in this circumstance to mean 'unknown')
>>
>> You could decide to tell the computer that you have 27 apples or you
>> could not.
>>
>> If you do not then the value would be null. (rather than 0 which most
>> people would agrees represented the "solid fact of there being no apples
>> at all)
>>
>> Therefore the null represents an as yet unknown or unspecified value.
>>
>> To put it another way. If the computer tells you "it has 'null' apples",
>> what would any reasonable programmer taken that to mean. what would you
>> take it to mean.
>>
>> Another good example could be a company with employees. you could
>> (Please excuse the VB here but I'm quicker using it and there are only
>> reference types in this example so initialising to null shouldn't be a
>> contraversial point here)
>>
>> -------------------------------------------------------------
>> Class Company
>> Private mCompanyName as String
>> Public Employees as Collection(Of Employee) Public Sub
>> New(CompanyName as String)
>> mCompanyName = CompanyName
>> End Sub End Class
>> -------------------------------------------------------------
>>
>> After construction, an object of type company, would be a (very
>> incomplete) representation of a company in the real world.
>> In the real world, the company might have 5 or 100 Emplyees.
>>
>> This information doesn't exist for the class yet and can it be reasonable
>> stated that it is unknown to the class.
>>
>> However, we have not given an empty collection which might be interpreted
>> as inticating the "solid fact" that the company has 0 employees.
>>
>> This is the use of null to mean that we do not know the correct value or
>> that it is as yet not available to us(perhaps because a lazy load has not
>> yet taken place or perhaps because the database record from which this
>> data might have been drawn did not specify for this particular company.
>>
>> This is a common interpretation of the "meaning" null.
>>
>> As someone indicated earlier in this thread, the meaning of "meaning" is
>> subject to interpretation (sorry for going a little bit meta).
>>
>> We can interpret as I have above or we can interpret as if the use wanted
>> to know the strict definition of null.
>>
>> I feel that Patrice has the correct interpretation of the original
>> poster's intention.
>>
>> The original posters question is best answered (IMHO) by indicating how
>> one might usefully use a null.
>>
>> The truth is that nobody should care whether a variable was assigned null
>> or whether it was null by virtue of not having ever been set.
>> This is because after either of these 2 events has occurred, noone can
>> tell which did cause it.
>>
>> At this point "unassigned" becomes the same as "assigned null"
>>
>> You can be as picky as you like and refer back to the specification as
>> much as you like.
>>
>> Despite the fact that internally c#(and many other languages) represent
>> null as a special yet constant value (so that (null = null) is true...
>> ... Nobody cares what that value is (whether it is or is not a value).
>> the real crux of the matter is "what is it used for?", "how is it
>> useful?" or "what did the programmer of this code mean when (s)he used
>> it?"
>>
>> Ok that was a lot to type and I think I've repeated myself a lot. I have
>> not tried to insult anyone, so if you do feel as if I have then I'm
>> sorry.
>>
>> Either way.... Tag.... you're all IT :P
>>
>> [BTW... "IT" is a special constant value (whose internal value we don't
>> really care about) which when applied to an individual or group,
>> designates them to be the person whose turn it is.]
>>
>> Sorry couln't resist
>>
>> --
>> Rory
>>
>>
>>

>
>



Reply With Quote
  #57  
Old 04-06-2007, 10:41 AM
Scott M.
Guest
 
Default Re: C# Nullable types

Because your first (and all the other) post(s) were only providing useage
scenarios. You never provided a definition. And (as I stated way back),
the analogy you used, I feel was incorrect and misleading.


"Patrice" <http://www.chez.com/scribe/> wrote in message
news:O%23db3nEeHHA.1216@TK2MSFTNGP03.phx.gbl...
> Got it now but I give up anyway to understand what you thought that the OP
> just wanted a definition without being interested in how he could use
> it...
>
> Bye.
>
>
> "Scott M." <s-mar@nospam.nospam> a écrit dans le message de news:
> ua$DSU8dHHA.4688@TK2MSFTNGP04.phx.gbl...
>> Rory,
>>
>> I get what she is saying, but she is not getting my reply. As you state,
>> she is giving *uses* for null, not a definition of null. This has been
>> my whole point with her posts. I never said her example of the usage of
>> null was wrong, I said it was wrong to hold the usage up as a definition,
>> that's all.
>>
>>
>> "Rory Becker" <RoryBecker@newsgroup.nospam> wrote in message
>> news:b0ac48a0838e8c945e37bdb4550@msnews.microsoft. com...
>>>>> If you don't know the value, you don't know it is 27 so you'll have
>>>>> a "null" value anyway as you can't do better....
>>>>>
>>>> NO! Stop right there. That is false! Just because I don't know the
>>>> value doesn't mean it can't have a value (like 27). Variables are
>>>> great examples of holders of potentially unknown values, that doesn't
>>>> make all variables null does it?
>>>
>>> Sorry Scott. I don't think you understand what Patrice is trying to say.
>>>
>>> (In fairness, I can't guarentee that I do either but according to my
>>> interpretation, she's making sense. (erm that is a femanine name where
>>> you come from? Right Patrice? I don't want to be insulting anyone
>>> This thread's heated enough already. )
>>>
>>> The way I see it, Patrice is trying to explain a valid use of null and
>>> therefore a meaning which is appropriate for it.
>>>
>>> When Patrice says "If you don't know the value, you don't know it is
>>> 27", she means....
>>>
>>> If you don't tell the computer that you have 27 apples then this fact is
>>> unknown to the computer. This does not stop you from actually having the
>>> 27 apples though. As Patrice says, the best you can do is null
>>> (reasonably taken in this circumstance to mean 'unknown')
>>>
>>> You could decide to tell the computer that you have 27 apples or you
>>> could not.
>>>
>>> If you do not then the value would be null. (rather than 0 which most
>>> people would agrees represented the "solid fact of there being no apples
>>> at all)
>>>
>>> Therefore the null represents an as yet unknown or unspecified value.
>>>
>>> To put it another way. If the computer tells you "it has 'null' apples",
>>> what would any reasonable programmer taken that to mean. what would you
>>> take it to mean.
>>>
>>> Another good example could be a company with employees. you could
>>> (Please excuse the VB here but I'm quicker using it and there are only
>>> reference types in this example so initialising to null shouldn't be a
>>> contraversial point here)
>>>
>>> -------------------------------------------------------------
>>> Class Company
>>> Private mCompanyName as String
>>> Public Employees as Collection(Of Employee) Public Sub
>>> New(CompanyName as String)
>>> mCompanyName = CompanyName
>>> End Sub End Class
>>> -------------------------------------------------------------
>>>
>>> After construction, an object of type company, would be a (very
>>> incomplete) representation of a company in the real world.
>>> In the real world, the company might have 5 or 100 Emplyees.
>>>
>>> This information doesn't exist for the class yet and can it be
>>> reasonable stated that it is unknown to the class.
>>>
>>> However, we have not given an empty collection which might be
>>> interpreted as inticating the "solid fact" that the company has 0
>>> employees.
>>>
>>> This is the use of null to mean that we do not know the correct value or
>>> that it is as yet not available to us(perhaps because a lazy load has
>>> not yet taken place or perhaps because the database record from which
>>> this data might have been drawn did not specify for this particular
>>> company.
>>>
>>> This is a common interpretation of the "meaning" null.
>>>
>>> As someone indicated earlier in this thread, the meaning of "meaning" is
>>> subject to interpretation (sorry for going a little bit meta).
>>>
>>> We can interpret as I have above or we can interpret as if the use
>>> wanted to know the strict definition of null.
>>>
>>> I feel that Patrice has the correct interpretation of the original
>>> poster's intention.
>>>
>>> The original posters question is best answered (IMHO) by indicating how
>>> one might usefully use a null.
>>>
>>> The truth is that nobody should care whether a variable was assigned
>>> null or whether it was null by virtue of not having ever been set.
>>> This is because after either of these 2 events has occurred, noone can
>>> tell which did cause it.
>>>
>>> At this point "unassigned" becomes the same as "assigned null"
>>>
>>> You can be as picky as you like and refer back to the specification as
>>> much as you like.
>>>
>>> Despite the fact that internally c#(and many other languages) represent
>>> null as a special yet constant value (so that (null = null) is true...
>>> ... Nobody cares what that value is (whether it is or is not a value).
>>> the real crux of the matter is "what is it used for?", "how is it
>>> useful?" or "what did the programmer of this code mean when (s)he used
>>> it?"
>>>
>>> Ok that was a lot to type and I think I've repeated myself a lot. I have
>>> not tried to insult anyone, so if you do feel as if I have then I'm
>>> sorry.
>>>
>>> Either way.... Tag.... you're all IT :P
>>>
>>> [BTW... "IT" is a special constant value (whose internal value we don't
>>> really care about) which when applied to an individual or group,
>>> designates them to be the person whose turn it is.]
>>>
>>> Sorry couln't resist
>>>
>>> --
>>> Rory
>>>
>>>
>>>

>>
>>

>
>



Reply With Quote
  #58  
Old 04-06-2007, 11:26 AM
Scott M.
Guest
 
Default Re: C# Nullable types

....And, only providing useage (context) is not always sufficient for a clear
understanding of meaning (definition).

So, since you only provided useage, and I believe inaccurate useage at that
(database useage of null [which was, in itself misleading], rather than .NET
useage of null), there was no good description of C#'s null ever given by
you.


"Scott M." <s-mar@nospam.nospam> wrote in message
news:OtdFclFeHHA.4172@TK2MSFTNGP05.phx.gbl...
> Because your first (and all the other) post(s) were only providing useage
> scenarios. You never provided a definition. And (as I stated way back),
> the analogy you used, I feel was incorrect and misleading.
>
>
> "Patrice" <http://www.chez.com/scribe/> wrote in message
> news:O%23db3nEeHHA.1216@TK2MSFTNGP03.phx.gbl...
>> Got it now but I give up anyway to understand what you thought that the
>> OP just wanted a definition without being interested in how he could use
>> it...
>>
>> Bye.
>>
>>
>> "Scott M." <s-mar@nospam.nospam> a écrit dans le message de news:
>> ua$DSU8dHHA.4688@TK2MSFTNGP04.phx.gbl...
>>> Rory,
>>>
>>> I get what she is saying, but she is not getting my reply. As you
>>> state, she is giving *uses* for null, not a definition of null. This
>>> has been my whole point with her posts. I never said her example of the
>>> usage of null was wrong, I said it was wrong to hold the usage up as a
>>> definition, that's all.
>>>
>>>
>>> "Rory Becker" <RoryBecker@newsgroup.nospam> wrote in message
>>> news:b0ac48a0838e8c945e37bdb4550@msnews.microsoft. com...
>>>>>> If you don't know the value, you don't know it is 27 so you'll have
>>>>>> a "null" value anyway as you can't do better....
>>>>>>
>>>>> NO! Stop right there. That is false! Just because I don't know the
>>>>> value doesn't mean it can't have a value (like 27). Variables are
>>>>> great examples of holders of potentially unknown values, that doesn't
>>>>> make all variables null does it?
>>>>
>>>> Sorry Scott. I don't think you understand what Patrice is trying to
>>>> say.
>>>>
>>>> (In fairness, I can't guarentee that I do either but according to my
>>>> interpretation, she's making sense. (erm that is a femanine name where
>>>> you come from? Right Patrice? I don't want to be insulting anyone
>>>> This thread's heated enough already. )
>>>>
>>>> The way I see it, Patrice is trying to explain a valid use of null and
>>>> therefore a meaning which is appropriate for it.
>>>>
>>>> When Patrice says "If you don't know the value, you don't know it is
>>>> 27", she means....
>>>>
>>>> If you don't tell the computer that you have 27 apples then this fact
>>>> is unknown to the computer. This does not stop you from actually having
>>>> the 27 apples though. As Patrice says, the best you can do is null
>>>> (reasonably taken in this circumstance to mean 'unknown')
>>>>
>>>> You could decide to tell the computer that you have 27 apples or you
>>>> could not.
>>>>
>>>> If you do not then the value would be null. (rather than 0 which most
>>>> people would agrees represented the "solid fact of there being no
>>>> apples at all)
>>>>
>>>> Therefore the null represents an as yet unknown or unspecified value.
>>>>
>>>> To put it another way. If the computer tells you "it has 'null'
>>>> apples", what would any reasonable programmer taken that to mean. what
>>>> would you take it to mean.
>>>>
>>>> Another good example could be a company with employees. you could
>>>> (Please excuse the VB here but I'm quicker using it and there are only
>>>> reference types in this example so initialising to null shouldn't be a
>>>> contraversial point here)
>>>>
>>>> -------------------------------------------------------------
>>>> Class Company
>>>> Private mCompanyName as String
>>>> Public Employees as Collection(Of Employee) Public Sub
>>>> New(CompanyName as String)
>>>> mCompanyName = CompanyName
>>>> End Sub End Class
>>>> -------------------------------------------------------------
>>>>
>>>> After construction, an object of type company, would be a (very
>>>> incomplete) representation of a company in the real world.
>>>> In the real world, the company might have 5 or 100 Emplyees.
>>>>
>>>> This information doesn't exist for the class yet and can it be
>>>> reasonable stated that it is unknown to the class.
>>>>
>>>> However, we have not given an empty collection which might be
>>>> interpreted as inticating the "solid fact" that the company has 0
>>>> employees.
>>>>
>>>> This is the use of null to mean that we do not know the correct value
>>>> or that it is as yet not available to us(perhaps because a lazy load
>>>> has not yet taken place or perhaps because the database record from
>>>> which this data might have been drawn did not specify for this
>>>> particular company.
>>>>
>>>> This is a common interpretation of the "meaning" null.
>>>>
>>>> As someone indicated earlier in this thread, the meaning of "meaning"
>>>> is subject to interpretation (sorry for going a little bit meta).
>>>>
>>>> We can interpret as I have above or we can interpret as if the use
>>>> wanted to know the strict definition of null.
>>>>
>>>> I feel that Patrice has the correct interpretation of the original
>>>> poster's intention.
>>>>
>>>> The original posters question is best answered (IMHO) by indicating how
>>>> one might usefully use a null.
>>>>
>>>> The truth is that nobody should care whether a variable was assigned
>>>> null or whether it was null by virtue of not having ever been set.
>>>> This is because after either of these 2 events has occurred, noone can
>>>> tell which did cause it.
>>>>
>>>> At this point "unassigned" becomes the same as "assigned null"
>>>>
>>>> You can be as picky as you like and refer back to the specification as
>>>> much as you like.
>>>>
>>>> Despite the fact that internally c#(and many other languages) represent
>>>> null as a special yet constant value (so that (null = null) is true...
>>>> ... Nobody cares what that value is (whether it is or is not a value).
>>>> the real crux of the matter is "what is it used for?", "how is it
>>>> useful?" or "what did the programmer of this code mean when (s)he used
>>>> it?"
>>>>
>>>> Ok that was a lot to type and I think I've repeated myself a lot. I
>>>> have not tried to insult anyone, so if you do feel as if I have then
>>>> I'm sorry.
>>>>
>>>> Either way.... Tag.... you're all IT :P
>>>>
>>>> [BTW... "IT" is a special constant value (whose internal value we don't
>>>> really care about) which when applied to an individual or group,
>>>> designates them to be the person whose turn it is.]
>>>>
>>>> Sorry couln't resist
>>>>
>>>> --
>>>> Rory
>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:06 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.