Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Resumable cancellable with trampolined binds#18733

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
majocha wants to merge16 commits intodotnet:main
base:main
Choose a base branch
Loading
frommajocha:cancellable-guard

Conversation

majocha
Copy link
Contributor

Description

Just to see if it works at all. Don't worry about it.

This is revived#18285 with cancellable CE reimplemented using resumable code.
Binds are trampolined so if things do work, deep recursion should not be a problem regardless of tailcalls.

The complexity probably makes it not worth it to reimplement just thecancellable, but it could be a starting point to replace internally all the asyncs (and cancellables) in FCS with a compatible and more effective resumableasync2 implementation.

@github-actionsGitHub Actions
Copy link
Contributor

❗ Release notes required

@majocha,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based onKeep A Changelog format.

The following format is recommended for this repository:

* <Informative description>. ([PR #XXXXX](https://github.com/dotnet/fsharp/pull/XXXXX))

See examples in the files, listed in the table below or in th full documentation athttps://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

If you believe that release notes are not necessary for this PR, please addNO_RELEASE_NOTES label to the pull request.

You can open this PR in browser to add release notes:open in github.dev

Change pathRelease notes pathDescription
src/Compilerdocs/release-notes/.FSharp.Compiler.Service/10.0.100.mdNo release notes found or release notes format is not correct

@@ -4869,7 +4869,7 @@ module TcDeclarations =
//-------------------------------------------------------------------------
// Bind module types
//-------------------------------------------------------------------------

#nowarn FS3511
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is failing to compile statically, which is another problem.

@T-Gro
Copy link
Member

(side thought - if we had a compiler-only usage of an async variant, we could use it to dogfood under flags when we decide to use runtime's async implementation. The compiler could also provide testing of deeply recursive scenarios there - might be valuable even for the runtime impl itself. But obviously we would have to accept the change of semantics, which will not work for the general library usage of async)

majocha reacted with thumbs up emoji

@majocha
Copy link
ContributorAuthor

This is currently driven be an explicit synchronous loop.

Another approach would be to use something similar toCancellableTask. That would mean a (mostly) synchronous execution driven byAsyncMethodBuilder, with occasional yields inBind to allow unlimited recursion without stack overflow.

The problem would be withpropagating exceptions (including cancellation) from deep call chains. It could get very expensive, because of async stack trace stitching, see (TheAngryByrd/IcedTasks#3 (comment)).

As a side note, currentasync implementation has very fast zero-cost cancellation, unlimited recursion and while stack traces are problematic, throwing from deeply nested code is not. This is something valuable to preserve in a potential resumableasync2.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
Status: New
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@majocha@T-Gro

[8]ページ先頭

©2009-2025 Movatter.jp