Can’t get no VB Action ?

Paul Stovell finally notices the lack of support for statement lambdas in VB9.  Unfortunately Vb9 only supports lambda expressions such as can be expressed in today’s expression trees.  .NET 4.0 will most probably include support for lambda statements, and hopefully at the same time VB10 will have support for them too.

When support for multi statement lambdas was dropped from VB, I complained bitterly.  It’s a real pain, especially if you want to just add something benign like logging into a lambda: in VB9 you can’t easily.  Yes there are “work arounds”, but if you need to capture surrounding variables, then it’s a huge pain as you need to manually write the captures (promotion of local variables into fields in another class).

Of course fixing this feature, is on my VB10 wish lists.  It’s listed as item 6 in the first part of VB10 feature wishes.

The nice thing for VB in all of this though, is it will probably never have to separate what can and can’t be expressed as an expression tree.  C# has kind of made a mess around anonymous delegates and lambdas (I’ve even heard Anders admit to that !). 😉