Anders Hejlsberg: Introducing Async – Simplifying Asynchronous Programming
- Posted: Oct 28, 2010 at 10:13 AM
- 128,072 Views
- 33 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Microsoft Technical Fellow and C# creator Anders Hejlsberg explains the new C# and VB.NET asynchronous programming model, available as Async CTP now, which makes async programming much easier for .NET developers.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
Async CTP link doesn't work
@Michael: Will work soon. Sorry, I jumped the gun
C
oh, they are doing it for C# too, when this emerges on PDC08 IIRC its a VB language feature, oh right they are co-evolving now, mmm...
@felix9: What are you talking about? Watch the video...
C
uhhh...maybe its just my first sight of these stuff are demoed in vb language ... heh
busy watching PDC now ...
Iterators and async, IEnumerable and IObservable, state machines and duality, oh yes, LINQs abound.
Great explanation from Anders.
Isn't it amazing how how much easier it is to comprehend a complex subjecct when presented by someone with so much enthusiasm?
Great work Anders & Team. Can't wait to see what you attack next
the async stuff sounds great. Any plans in C# to make dependency properties a part of the language? Having to understand and debug dependency properties made learning WPF kind of hard for me.
Erm... how come no comment on IObservable? Seriously guys, you talked about IEnumerable, iterators and all the good stuff, but not a word on Rx? What hath thou done Charles? *rant*
@Rafael: we talked about Rx in other interiews including the C9 Live session with Anders.
C
I know you can't have try { ... } finally { ...} or using (...) { ... } inside an iterator in .NET 2.0. Do asynchronous methods have the same problem?
this is what I have throughout my program and it is very annoying just like Mr. Anders mentioned, inverse flow of control with 2 delegate callbacks one for regular return, the other one for exception.
EventHandler<T> failureHandler = null;
EventHandler<T> successHandler = null;
failureHandler = (s,ea) =>
{
obj.FailureEvent -= failureHandler;
obj.SuccessEvent -= successHandler;
// handle failed state
...
};
successHandler = (s,ea) =>
{
obj.FailureEvent -= failureHandler;
obj.SuccessEvent -= successHandler;
// handle success state
...
};
obj.SuccessEvent += successHandler;
obj.FailureEvent += failureHandler;
obj.RunAsync();
I am very looking forward to this feature.
Hmm, I guess line break (carriage return) is not an option.
Does anyone know when this async stuff gets offically released? I guess my question is whether Async CTP is reliable enough to be incorporated into my product code.
Fantastic stuff, I need to read up on F#'s async some more and look at the TPL!
Did anyone else find themselves checking their inbox while watching that video ?
For some reason, I really like this guy's attitude. Brilliance is one thing. Addressing the credit is one thing. But, something else makes me really put me in comfort with him. Maybe he makes it easier to understand for me. Or maybe some other reasons. So, I hope he continues his good work in MS and I hope MS values his work too. After all, I hope to use his stuff for a long long time.
@ elmer. Absolutely. But then I realized I didn't have Windows Live Mail open. Nice explanation Mr. Anders.
@elmer:Nope.
I don't mean to be mean, but Anders did dodge the final question. In having asynchrony done by the compiler you will lose control, so... how well is it optimised, what efficiency compromises are inherent in a solution that cannot be "hand-coded". Hejlsberg just turned around the question and answered it as if it had been about the comparatively minimal creeping featurism of the syntax.
Hmm.. I think this is more for the VB guys, its already easy using anonymous methods from C# for which this syntax is just a shortcut (I am guessing):
someThread.BeginInvoke(new Action(delegate()
{
// do something
});
No Async love for Express editions? I tried installing the CTP (I have Visual Studio Web Developer and C# Express installed) but could not located the Async DLLs after.
@ecofriend: let me find out as I'd love to use this in some Coding4Fun projects
@ecofriend: got a response by the always wonderful LIsa Feigenbaum over at the MSDN forums. http://social.msdn.microsoft.com/Forums/en-US/async/thread/4945ecf1-b242-4173-9ada-570c731bd3fb
Quick answer is: current CTP is Visual Studio 2010 Professional, Premium or Ultimate only. You can download a trial at http://www.microsoft.com/visualstudio/en-us/download
What if ALL functions will be decared async automatically? What are the implications of that?
@Clint: Thanks.
@ecofriend: Express SKUs are not supported. you can download one of the trial version of Visual Studio from here http://www.microsoft.com/visualstudio/en-us/download
Why did you choose to implement it so that an await statement can only be resumed once? For example you can't implement await on List (or most other monads for that matter):
async List<int> CartesianProduct(List<int> A, List<int> B){
var a = await A;
var b = await B;
return new Tuple(a,b);
}
Great work !
I'm sort of sad
Because of parallel and async tasks I had an argument to start learning F#. Now I have only wait for new C#
@Algida: Well. Don't be sad! And do learn F#. Also, learn other forms of parallel and async expression in C# using Tasks and Rx and Concurrent Revisions
So much to learn. So little time.
C
@Charles:Yup you are right, I just getting into current C# and .Net4, till I will get into f# there will be next c# it is so so little time to learn it
@Algida: As Herb Sutter always says, learn as many languages as you can. Make it entertainment so you actually do it (if you don't enjoy it then it will be hard to be entertained by it).This allows you to express problems and solutions with more tools, some being better suited for the specific job at hand. More importantly, it teaches you how to think about programmming in multiple dimensions (like functional (F#) and imperative/hybrid (C#)).
You are right, of course. Start off with the fundamentals (just as reading music is to playing an intsrument or instruments in highly expressive ways). The music analogy only goes so far and some will be quick to point out the logical flaws therein, but you get the idea.
C
Remove this comment
Remove this thread
close