Skip to content

[WIP] Compare async/await to ContinueWith #47075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 2, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Hello,

As far as I understand, async/await is just syntactic sugar over the Task function ContinueWith. For instance, if we have a Task t and a function f, then X x = await t; return f(x); is the same as t.ContinueWith((x) => { return f(x.Result); });.

Then instead of comparing synchronous code versus async/await code, I would recommend to compare asynchronous code by ContinueWith to asynchronous code by async/await. In the particular breakfast example of this webpage, we would see 2 almost identical codes, because all async methods have only one or two awaits.

The async/await notation is called "monadic do-notation" in functional programming, and it is most useful when there are 3 or 4 monadic values to combine in a single function. Here that would mean 3 or 4 awaits in a single function, then we would see a big simplification compared to intertwined lambda functions inside ContinueWiths.

Moreover, the discussion of synchronous code might be skipped altogether in this page. The difference between monothread and multithread algorithms has become common these days, people are probably already familiar with them.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Fixes #21296.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compare async/await to ContinueWith
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy