The idea of returning functions via yield return to simply asynchronous IO programming has a precedent in Microsoft's Concurrency and Coordination Runtime:
http://msdn.microsoft.com/en-us/library/bb648753.aspx
Although they are yielding interfaces, really they are yielding functions:
http://msdn.microsoft.com/en-us/library/microsoft.ccr.core.itask_members.aspx
The ITask interface has only one really important method: Execute, which means that really it's a function (a delegate in C# terms). I think the functional style makes the whole thing cleaner, but the point is that the idea was already in use in the Microsoft's CCR, perhaps as long ago as 2005 (although that's difficult to verify).
2 comments:
The code in the CCR is also based on Jeffrey's code. Here is the video
http://channel9.msdn.com/shows/Going+Deep/CCR-Programming-Jeffrey-Richter-and-George-Chrysanthakopoulos/
I can't understand why Jeffrey now recommends something that is harder to get right, i.e. manually yielding the correct integer value for the number of asynchronous operations launched.
Post a Comment