Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iterators in VB.NET vNext, and limitations of iterators in C#

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# ?

like image 646
Thomas Levesque Avatar asked Feb 25 '23 22:02

Thomas Levesque


1 Answers

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#.

like image 145
Eric Lippert Avatar answered Apr 09 '23 18:04

Eric Lippert