VB 10 thoughts (part 9)


31. Templates for anonymous types

It’d be nice if you could change the template used for anonymous types, such as to include INotifyPropertyChanged or other functionality. If you add a template to your project, you could then specify which template to use, e:g

Dim customer = New With{.FirstName=”Fred”, .LastName=”Flintstone”} BasedOn mytemplate


Dim projection = From c in Customers _
                            Where c.LastName=”Flintstone” _
                            Select New {c.LastName, c.FirstName} BasedOn mytemplate


32. Scripting support

Runtime features like creating new types on the fly (including support for templates as per #31), an Eval function, and general ease of dynamic interaction.


33. Support for parallel programming

Full support and possible language enhancements around multiprocessor architecture and parallel programming.


34. Lean and Mean option

Ability to turn off, or make it a warning anytime any VB helper functions are used, as well as make the assembly as light weight as possible.  For example, if I had Option LeanAndMean On, a If string1 = string2 statement would use String.Equals rather than any VB helper library functions.

This entry was posted in 491, 5162, 5726. Bookmark the permalink.

4 Responses to VB 10 thoughts (part 9)

  1. tom says:

    I vote for scripting support.

    The MSScriptControl is somewhat useable, but it uses COM. It would be nice to have a .NET solution.


  2. Morgan says:

    #31 BasedOn, do you mean like Inherits ?

  3. Bill says:

    Hi Morgan,

    Nope, I mean a replacement template. The template in this case would have to include the class definition, and as such could dictate what the inheritance chain is.


    # Begin Template

    Class $uniquename$
    Implements INotifyPropertyChanged

    Private backingValues As New Hashtable

    Public Property $PropertyName$ As $PropertyType$
    return CType(backingValues($PropertyName$),$PropertyType$)
    End Get
    Set(ByVal value as $PropertyType$)
    If Not $PropertyName$.Equals(value) Then
    backingValues($PropertyName$) = value
    End Set
    End Property


    Private Sub OnPropertyChanged(name as string)
    RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(name))
    End Sub

    End Class

    # End Template

  4. bill says:

    oh, I should add that’s a simplified syntax. Because VB has both Key’ed and non keyed Properties in anonymous types, the replacement blocks would probably need to be idenitified as “Key” and “Non key”

Leave a Reply

Your email address will not be published. Required fields are marked *