WARNING: This is a speculative post. Caveat emptor.
I haven’t finished reading through all the comments from my previous post yet, but I did think it was worth stating that we are considering improvements to lambda expressions in the next version. Specifically, we’re looking at allowing single-line lambdas that don’t actually return anything, something like:
Dim x = Sub() Console.WriteLine(10)
This was something we wanted to support in 2008, but just ran out of time for. We’re also thinking about multi-line lambdas that contain statements instead of just a single expression. So something along the lines of:
Dim y = Function(x) If x > 0 Then Return x Else Return -x End If End Function
Like C#, we’d infer the return type of a multi-line lambda by attempting to pick the best type of all the Return statements.
This is really a common request, so it’s definitely something we’re strongly considering.