[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ProgSoc] Programming! Code!



On Thu, 2006-10-19 at 21:03 +1000, Nigel Sheridan-Smith wrote:

> > Interesting; spec# claims to add non-null types, but your test suggests
> > that even System.Boolean is already non-null.
> > 
> > Oh well, syntax trivia...
> > 
> 
> Maybe by "non-null" they mean objects that can never be null (in valid
> code). Constants without being constant?

Your test suggests that Boolean already cannot be null in C#. I'm not
sure what you mean by "constants without being constant".

> Ahhh more reading... 
> 
> .NET 2.0 adds Nullable types, so you can explicitly add "null" as a valid
> value to the value types. Presumably this is used for RDBMS.

If I'm getting this right (I'm still finding it difficult to believe),
then C# is the first widely-used OO language that I've encountered which
does not have null object references (explicit references to no object).
This is not quite the same as "null" (the complete absence of a value,
rather than an explicit reference to no value) in a relation, but the
two can be and frequently are readily mapped onto each other.

The other place that it's frequently useful in Java is to explicitly
represent intentional absence of a value, e.g. for a "don't know" or
"not specified" situation; a Boolean object reference can, by virtue of
being an object reference, be a null object reference (a explicit
reference to no object) and, therefore, explicitly represent the absence
of a value. "boolean" on the other hand is a primitive value type (not a
reference) and, therefore, cannot be "null" in either sense.


-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@xxxxxxxxxxxxxxxxxxx
If you are having trouble, ask owner-progsoc@xxxxxxxxxxxxxxxxxx for help.