Right off the bat, on the first thing I study in .NET 2.0, there is something that looks fundamentally wrong to me - nullable types and boolean.
Skills measured by exam 70-551
Section 1
Developing applications that use system types and collections
Manage data in a .NET Framework application by using .NET Framework 2.0 system types. (Refer System namespace)
Value types
Nullable type
Syntax:
bool? nullBool = null;
- Nullable, hasvalue property,boolean now has 3 values! return (int?) cmd.ExecuteScalar(); Null coalescing operator (x ?? Y) - default x to Y if null
G. Shaw said:
I hope you and the other language designers know what you are doing for the long run. The current C# language is thing of beauty with very few warts. By adding the Big Four plus this new feature I worried that you are starting to move the language from a simpiler easier to use language more into the realm of C++ hell. I've worked with C# for years now (since beta 1) and find the language has been perfect. The language is so explicity about what it is doing, adding new funky operators makes the language more confusing as it isn't immediately obvious what is being down.
Please do a lot of usability testing with the syntax of this feature. I can see a need but I really think it should be done as a keyword and not an operato. For example,
nullable int a;
nullable int b;
nullable int c = a+ b;
Is immediately obvious what we are doing. The int? syntax is alien and is painful to read/understand. Since this is a feature that isn't going to be used all the time people are going to have look it up to understand how it works when the encounter it.
How can a bool have three values! It can't, that's why you need a new type: nullable bool. In fact I'd keep it as Nullable
What's next... Reference types and attributes... Hmm. Only 450 or so items to cover in 2 weeks.
No comments:
Post a Comment