Anders Hejlsberg: Introducing Async – Simplifying Asynchronous Programming

Sign in to queue

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

Download

Download this episode

The Discussion

  • User profile image
    Michael

    Async CTP link doesn't work

  • User profile image
    Charles

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

  • User profile image
    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...

  • User profile image
    Charles

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

    C

  • User profile image
    felix9

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

    busy watching PDC now ...

  • User profile image
    exoteric

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

    Great explanation from Anders.

  • User profile image
    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

  • User profile image
    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.

     

  • User profile image
    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*

  • User profile image
    Charles

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

  • User profile image
    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?

  • User profile image
    _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.
     

  • User profile image
    _ivan

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

  • User profile image
    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.

  • User profile image
    wil2300

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

  • User profile image
    elmer

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

  • User profile image
    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.

  • User profile image
    Sadatay

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

  • User profile image
    exoteric

    @elmer:Nope.

  • User profile image
    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.

  • User profile image
    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
    });
     
     

  • User profile image
    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.

  • User profile image
    Clint

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

  • User profile image
    Clint

    @ecofriend: got a response by the always wonderful LIsa Feigenbaum over at the MSDN forums.  https://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 https://www.microsoft.com/visualstudio/en-us/download

  • User profile image
    Nizhegorodov

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

  • User profile image
    ecofriend

    @Clint: Thanks.

  • User profile image
    Avner Aharoni

    @ecofriend: Express SKUs are not supported. you can download one of the trial version of Visual Studio from here https://www.microsoft.com/visualstudio/en-us/download

  • User profile image
    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);
    }

  • User profile image
    Rabeeh Abla

     
    Great work ! 

  • User profile image
    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 

  • User profile image
    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

  • User profile image
    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 

  • User profile image
    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

Add Your 2 Cents