Skip to content
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

IAsyncDisposable support? #6

Closed
Arshia001 opened this issue Jun 7, 2020 · 2 comments
Closed

IAsyncDisposable support? #6

Arshia001 opened this issue Jun 7, 2020 · 2 comments

Comments

@Arshia001
Copy link

Are there any plans to support the new IAsyncDisposable?

@NinoFloris
Copy link
Member

Yes! The second the compiler supports it :)

In a CE we're reliant on methods per language construct (For/While/Using/etc) of which the compiler only recognizes a few signatures, today the compiler does not recognize IAsyncDisposable as a Using overload. There are some discussions to add support for it though

Here fsharp/fslang-suggestions#866
and here fsharp/fslang-suggestions#853

I'll close this out for now.

@Arshia001
Copy link
Author

Yes, I'm familiar with how CE's work. However, I don't believe you need language support for IAsyncDisposables. A let! or match! operates on a M<'a> and unwraps the 'a which, in this case, is a task that must be awaited to get the 'a inside. In the case of IAsyncDisposable, the result is available at assignment time and there is no waiting involved. The waiting must happen within the finally function in a tryFinally. This is quite possible to achieve without language support I believe (though the code will be somewhat convoluted). There's already an example of how to do this at fsharp/fslang-suggestions#866.

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

No branches or pull requests

2 participants