Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you think F#'s async workflows will be introduced in C# in the future?

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?

like image 879
Attila Kun Avatar asked Dec 10 '25 07:12

Attila Kun


2 Answers

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.

like image 130
Tomas Petricek Avatar answered Dec 12 '25 21:12

Tomas Petricek


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

like image 27
Sebastian Good Avatar answered Dec 12 '25 21:12

Sebastian Good