views:

124

answers:

1

I just saw on the Async CTP website that the next version of VB.NET will have iterators. I guess they included iterators because the rewriting process is similar to the one used for the new async/await feature.

But reading the document that explains the feature, I realized that VB.NET iterators will actually have features that are not available in C# today, namely:

  • iterator blocks in a try/catch block
  • anonymous iterator blocks

These were known limitations in C#. Is there any chance that these limitations will be removed in C# 5 ? If not, is there any reason why it can be done in VB.NET and not in C# ?

+7  A: 

Is there any chance that these limitations will be removed in C# 5 ?

There is a slim chance. I certainly wouldn't count on it. Those are "nice to have" features, not "must have" features, and when you have an enormous amount of work to do, the "nice to have" features sometimes fall off the schedule, as nice as they are.

If not, is there any reason why it can be done in VB.NET and not in C# ?

Any technical reason? No. There are engineering reasons of course.

Often it is the case that being the second team to implement a particular feature is beneficial. The implementors of a second implementation get to take advantage of the knowledge gained from the first attempt without taking on so large a research and development cost, while not incurring any maintenance or backwards compatibility taxes.

VB has the benefit of not having had this feature already and therefore has no existing body of millions of lines of user code that they need to be 100% backwards compatible with. That is a considerable cost burden removed. And they have a large database of bug reports, design notes, and so on, from eight years of having this feature in C#.

Eric Lippert
Thanks Eric, that makes sense of course... I just don't like to admit that VB has something more than C# ;)
Thomas Levesque
Or as Gilad Bracha put it in the PDC talk: "Once you have users, it's all over" :-)
Mauricio Scheffer
@Thomas: VB has XML literals also.
Eric Lippert
@Eric, yes, but it doesn't really count, because it's a feature I definitely don't want in C# ;)
Thomas Levesque
Thomas, you don't want XML literals in C#? You must not work in 'an enterprise setting'. ;) For my current project, we have a dedicated VB.NET project only to handle the XML files. Even though I prefer C# for everything, XML literals in VB.NET simply rock. Not only you can develop faster, XML literals code is at least 5 times more readable (and hence maintainable) than comparable code in C#. For me, XML literals are much more useful than anonymous iterator blocks and iterator blocks in try/catch. Your mileage may vary. Eric, how's the demand for XML literals in C#?
SolutionYogi