The VS 2008 VB will support nullable types.
Simply put, a nullable type is a standard type, like, say, integer or string that can ALSO contain a null.
This can become very important in database work, because a null value in a field means that no value has been assigned to that field vs a common case where you might use 0 in a numeric field to indicate no value, or you might use a null string (ie a string with no length) in a string field.
Obviously, using 0 to indicate no value works much of the time, but, there often comes a point when you actually do need to use a 0 value for that field. There’s a number of other, more arcane reasons that using one of the values from the range of possible values of a type to indicate null is usually not a good idea.
Hence, nullable types. With a nullable type, I can have an integer variable that can be a 31bit positive or negative number, or 0, and STILL have yet another “state” of that variable that indicates it’s null.
This will likely be incredibly handy for many many uses when working with database data.
But the syntax?
Dim a As Integer?
or
Dim a? As Integer
No, I’m not making that up.
What the hell? A question mark?
Why not just:
Dim a As Nullable Integer
I find this to be an unbelievably hypocritical decision given the almost overwhelming philosophical rants delivered by Microsoft about not using the traditional VB type specifier characters in .NET anymore (you know, $ for strings, % for integers, those bad boys). Heck, check page 42 of “Framework Design Guidelines” by Krzysztof Cwalina and Brad Abrams of Microsoft:
DO NOT use Hungarian notation (their bold, not mine)
Now, to be fair, the authors in this particular instance are discussing publicly available interfaces, but I’ve seen the same directive applied to internal coding as well. So, we’re not suppose to use hungarian, and we’re not supposed to use type characters, so we’re left to simply scan the code to information about how a variable is used or what it likely contains. Jeez. How convenient.