Charles

Anders Hejlsberg: Introducing Async – Simplifying Asynchronous Programming

Download this episode

Download Video

Description

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.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • Michael

      Async CTP link doesn't work

    • Charles

      @Michael: Will work soon. Sorry, I jumped the gun Smiley
      C

    • felix9

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

    • Charles

      @felix9: What are you talking about? Watch the video...

      C

    • felix9

      uhhh...maybe its just my first sight of these stuff are demoed in vb language ... heh Tongue Out

      busy watching PDC now ...

    • exoteric

      Iterators and async, IEnumerable and IObservable, state machines and duality, oh yes, LINQs abound.

      Great explanation from Anders.

    • BitCrazed

      Isn't it amazing how how much easier it is to comprehend a complex subjecct when presented by someone with so much enthusiasm? Wink

      Great work Anders & Team. Can't wait to see what you attack next Big Smile

    • SteveRichter

      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.

       

    • Rafael

      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*

    • Charles

      @Rafael: we talked about Rx in other interiews including the C9 Live session with Anders.
      C

    • TommyCarlier

      I know you can't have try { ... } finally { ...} or using (...) { ... } inside an iterator in .NET 2.0. Do asynchronous methods have the same problem?

    • _ivan

      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.
       

    • _ivan

      Hmm, I guess line break (carriage return) is not an option.

    • Behrouz

      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.

    • wil2300

      Fantastic stuff, I need to read up on F#'s async some more and look at the TPL!

    • elmer

      Did anyone else find themselves checking their inbox while watching that video ?

    • magicalclick

      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.

    • Sadatay

      @ elmer. Absolutely. But then I realized I didn't have Windows Live Mail open. Nice explanation Mr. Anders.

    • exoteric

      @elmer:Nope.

    • Uncompetati​ve

      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.

    • Mrk Mnl

      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
      });
       
       

    • ecofriend

      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.

    • Clint

      @ecofriend: let me find out as I'd love to use this in some Coding4Fun projects

    • Clint

      @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

    • Nizhegorodov

      What if ALL functions will be decared async automatically? What are the implications of that?

    • ecofriend

      @Clint: Thanks.

    • Avner Aharoni

      @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

    • Jules

      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);
      }

    • Rabeeh Abla

       
      Great work ! 

    • Algida

      I'm sort of sad Sad Because of parallel and async tasks I had an argument to start learning F#. Now I have only wait for new C# Smiley 

    • Charles

      @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 Smiley So much to learn. So little time.
      C

    • Algida

      @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 Smiley 

    • Charles

      @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

    Comments closed

    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.