开发者

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

开发者 https://www.devze.com 2023-01-23 08:50 出处:网络
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/awai

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消