|
NULLABLE TYPES FAQ _
NullableTypes vs. Nullable<T> (Whidbey)
Q: Will System.Nullable<T> generic type replace NullableTypes?
A: The short answer is no. The full answer follows.
In 2004 .NET Framework 1.2 and C# 2.0 will be released. They implement the generic type
System.Nullable<T> that define a standard way to deal with null values for value-types
(C # Version 2.0 Specification July 2003, Chapter 20.5.7 The System.Nullable type).
Due to actual limitations of Generics implementation (they miss user-specializations)
System.Nullable<T> is only a partial solution for the built-in types. Indeed every
built-in type have specific features that differ from other built-in types and without
user-specializations these specific features cannot be exposed.
So System.Nullable<T> will not replace NullableTypes instead NullableTypes for
Whidbey will continue to provide features that are missing in System.Nullable<T> for
built-in types, will be totally compatible with System.Nullable<T> and will enhance
and extend System.Nullable<T> features for built-in types.
An example of features that are missing in System.Nullable<T> follows:
every type in NullableTypes
- avoid the users to do a frequent explicit access to the wrapped built-in type because
it is very very similar (quite indistinguishable) to the corresponding built-in type
- avoid conditional tests for null (if is null then... else...) to spread in the source
code because it implements Null Object pattern [1][2]
- extends operators with the NULL semantic [3]
[1] Test-Driven Development - Kent Beck - Three Rivers Institute -
http://groups.yahoo.com/group/testdrivendevelopment/files/TDD17Jul2002.pdf
[2] Refactoring: Improving the Design of Existing Code - Martin Fowler, Kent Beck et al. -
Addison Wesley Professional - 1999 -
http://www.refactoring.com/catalog
[3] SQL92 (ISO/IEC 9075:1992, Database Language SQL- July 30, 1992) -
http://www.contrib.andrew.cmu.edu/%7Eshadow/sql/sql1992.txt
|
|