First of all, I apologize because of my foolish question, I really don't know much about F#. But I know that it makes thread handling significantly easier. However, seeing the language construct someone might wonder why C# should miss the coolness that is asynchronous workflows? What theoretical limitation does C# have that prevents the aforementioned feature from being introduced?
I don't know the answer to your question, but regarding Concurrency and Coordination runtime - there are actually simpler alternatives (also based on yield return). I wrote one article about it a long time ago and there is also Jefrey Richters "PowerThreading" library, which is surprisingly simple and powerful (and uses the same trick).
Asynchronous Programming in C# using Iterators - my article, which shows how to encode F# asynchronous workflows using C# iterators (very directly)
More AsyncEnumerator Features - discusses how PowerThreading library uses yield return for asynchronous programming (it uses slightly different programming model, but also very clean and simple, especially compared to CCR).
To answer the question whether it would be technically possible to have something like F# asynchronous workflows in C# - I'd say yes - it's actually an idea pretty similar to iterators (and as you can see, you can use C# iterators for asynchronous programming already!) though there would be some interesting problems to resolve.
Yes, I think they will.
http://blogs.msdn.com/b/ericlippert/archive/2010/10/29/asynchronous-programming-in-c-5-0-part-two-whence-await.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With