Visual Basic 10 will have an improved compiler that makes underscores optional for most line continuations. This represents a significant change for VB, traditionally a line-terminated language. The Visual Basic team has an in-depth explanation of Implicit Line Continuation.
VB 1-6 and VB.NET (7-9) used the carriage return as a statement termination token, similar to the explicit semicolon ";" in C#. By moving to an implicit termination token, Visual Basic language readability will be greatly improved, especially when writing multi-line LINQ queries.
Dim dates = from d in listOfDates _Could become:
where d.Year > 2009 _
select d _
order by d
Dim dates = from d in listOfDatesThe VB team explanation mentioned above covers specific cases where implicit line continuation is not supported:
where d.Year > 2009
order by d
We don’t capture every scenario. Given our cost and time constraints around the feature, we tried to capture the most common cases that would provide the most bang for the buck. We also avoided the ones that just led to problems. Here are some examples of problems you could have if we had decided to allow implicit continuation anywhere. I take these from some analysis that Lucian Wischik (also on the VB compiler team) did on our grammar:
With yIf we allowed implicit continuation before the ‘.’ we would have problems knowing what the period belongs to. For example, it could be interpreted as:
With yChannel 9 also has an excellent interview with Tyler Whitney, a developer on the Visual Basic compiler team.