Hacker News new | past | comments | ask | show | jobs | submit login

The new C# 5.0 proposes to bring asynchronous keywords, which I believe works like macros to turn imperative code into continuations.

  The “await” operator used twice in 
  that method does not mean “this method now blocks
  the current thread until the asynchronous 
  operation returns”. That would be making 
  the asynchronous operation back into a
  synchronous operation, which is precisely
  what we are attempting to avoid. Rather, 
  it means the opposite of that; it means
  “if the task we are awaiting has
  not yet completed then sign up the rest of
  this method as the continuation of that task,
  and then return to your caller immediately; 
  the task will invoke the continuation when 
  it completes.”
http://blogs.msdn.com/b/ericlippert/archive/2010/10/29/async...

    async void ArchiveDocuments(List<Url> urls)
    {
      Task archive = null;
      for(int i = 0; i < urls.Count; ++i)
      {
        var document = await FetchAsync(urls[i]);
        if (archive != null)
          await archive;
        archive = ArchiveAsync(document);
      }
    }
Microsoft has been very lucky to have someone like Anders Hejlsberg, who has steadily brought a stream of features to an enterprise programming language.



Note that this was (at least conceptually) derived from a (more or less) equivalent F# feature that exists in the shipping version today.



Yes, what is true is the fact, that they are finally working on a better ways to support async-code in a more frictionless way... (yes, Hejlsberg, F# team and Async Team rock, as does Erik Maijer)

They are still not where they would like to be though i guess: just check out what subtle issues you can run into by using this quite intuitive way of handling async resp. auto continuations:

"Await, and UI, and deadlocks! Oh my!" http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163....

I'd say they are on the right track, but still not there for big time ... just imagine this in hands of millions of average devs under pressure...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: