Saturday, October 6, 2007

VB 10

Paul Vick asks what people want for VB 10.

Here's my list:

1) Inline and multiline comments (why not just copy C's /* */?)

2) Option Overflow On/Off

3) Option Warning 30XXX On/Off/Error

3) The ability to apply Options to methods and/or blocks of code. Something like this maybe:


Block Option Strict Off, Option Overflow On
    'Some code here
End Block



I don't particularily like this syntax though, it's somewhat verbose.
Another idea might be to add it to the attribute syntax:


<Option Strict Off> _
Sub A
    <Option Overflow On> _
    Using x
    End Using
End Sub>


4) Select on types, like this:


Select TypeOf obj
    Case Integer
    Case Double
End Select


6) Select on reference equality


Select var Is
    Case objA
    Case objB
End Select


The proposed syntax here doesn't work:


Select obj   
    Case Is varA   
    Case Is varB
End Select


since this is already correct VB code. You can actually write this:


Select number   
    Case Is 1   
    Case Is 2
End Select


where the 'Is' works like a '='. The IDE will remove the 'Is', but it's still allowed. This is bad design IMHO, VB should never have allowed this since it's mixing the meaning of 'Is' and '='.

7) Binary numbers


Dim i As Integer = &B0110110


8) Static method / operator constraints on generic type parameters


Class Point (Of T {+, -})
End Class


Yeah, I know, this is a IL restriction, not a VB restriction, but still...

9) Option Warning 4XXXX On/Off/Error

10) The possibility to specify that sections of code should not be pretty formatted.


#Format None
Dim var As String ()() = new String () { _
            {"a",           "bbbbbb"}, _
            {"cccccccc", "ddd"}}
#End Format


Once in a while it is nice to be able to format the code just as you want yourself, especially when you can detect bugs due to things not being symmetric or lined up.

11) Do NOT allow the user to change pretty formatting (other than disabling it). It's worth it if it avoids the mess in the C world of what's correct formatting or not (how many spaces are there in a tab? 4, 8, 2, 128? where do we put the semi-colon? where do we put spaces?). And mixed formatting in source code is just plain ugly.