-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update ref-struct-interfaces.md #8024
Conversation
Co-authored-by: Cyrus Najmabadi <[email protected]>
proposals/ref-struct-interfaces.md
Outdated
``` | ||
|
||
A `using` statement will recognize and use implementation of `IAsyncDisposable` interface when resource is a type parameter that | ||
`allows ref strict`, there is no `DisposeAsync` pattern match, and `IAsyncDisposable` is in type parameter's effective interfaces set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`allows ref strict`, there is no `DisposeAsync` pattern match, and `IAsyncDisposable` is in type parameter's effective interfaces set. | |
`allows ref struct`, there is no `DisposeAsync` pattern match, and `IAsyncDisposable` is in type parameter's effective interfaces set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
using
statement will recognize and use implementation ofIAsyncDisposable
interface when resource is a type parameter that
allows ref strict
, there is noDisposeAsync
pattern match, andIAsyncDisposable
is in type parameter's effective interfaces set.
Currently, it looks like we use IAsyncDisposable
even if there is a DisposeAsync
pattern (available through an interface) - see sharplab.io.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
using
statement will recognize and use implementation ofIAsyncDisposable
interface when resource is a type parameter that
allows ref strict
, there is noDisposeAsync
pattern match, andIAsyncDisposable
is in type parameter's effective interfaces set.Currently, it looks like we use
IAsyncDisposable
even if there is aDisposeAsync
pattern (available through an interface) - see sharplab.io.
I can see how this could be confusing, but there is no pattern match in this case due to an ambiguity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment here (and below) was about the text rather than the example. The text seems to state we'll use the interface implementation when there is no pattern implementation, which might imply that if there was a pattern implementation, we'd use the pattern implementation instead. But currently it looks like we use the interface implementation regardless of whether there is a pattern implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no
DisposeAsync
pattern match
The statement doesn't talk about " a pattern implementation" there, it talks about "a pattern match", which doesn't have to exists (and in fact doesn't in some scenarios) when there is a pattern implementation.
proposals/ref-struct-interfaces.md
Outdated
``` | ||
|
||
A `foreach` statement will recognize and use implementation of ```IEnumerable<T>```/```IEnumerable``` interface when collection is a type parameter that | ||
`allows ref strict`, there is no `GetEnumerator` pattern match, and ```IEnumerable<T>```/```IEnumerable``` is in type parameter's effective interfaces set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`allows ref strict`, there is no `GetEnumerator` pattern match, and ```IEnumerable<T>```/```IEnumerable``` is in type parameter's effective interfaces set. | |
`allows ref struct`, there is no `GetEnumerator` pattern match, and ```IEnumerable<T>```/```IEnumerable``` is in type parameter's effective interfaces set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
foreach
statement will recognize and use implementation ofIEnumerable<T>
/IEnumerable
interface when collection is a type parameter that
allows ref strict
, there is noGetEnumerator
pattern match, andIEnumerable<T>
/IEnumerable
is in type parameter's effective interfaces set.
Currently, it looks like we use IEnumerable<T>
even if there is a GetEnumerator
pattern (available through an interface) - see sharplab.io.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
foreach
statement will recognize and use implementation ofIEnumerable<T>
/IEnumerable
interface when collection is a type parameter that
allows ref strict
, there is noGetEnumerator
pattern match, andIEnumerable<T>
/IEnumerable
is in type parameter's effective interfaces set.Currently, it looks like we use
IEnumerable<T>
even if there is aGetEnumerator
pattern (available through an interface) - see sharplab.io.
I can see how this could be confusing, but there is no pattern match in this case due to an ambiguity.
proposals/ref-struct-interfaces.md
Outdated
``` | ||
|
||
An `await foreach` statement will recognize and use implementation of ```IAsyncEnumerable<T>``` interface when collection is a type parameter that | ||
`allows ref strict`, there is no `GetAsyncEnumerator` pattern match, and ```IAsyncEnumerable<T>``` is in type parameter's effective interfaces set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`allows ref strict`, there is no `GetAsyncEnumerator` pattern match, and ```IAsyncEnumerable<T>``` is in type parameter's effective interfaces set. | |
`allows ref struct`, there is no `GetAsyncEnumerator` pattern match, and ```IAsyncEnumerable<T>``` is in type parameter's effective interfaces set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An
await foreach
statement will recognize and use implementation ofIAsyncEnumerable<T>
interface when collection is a type parameter that
allows ref strict
, there is noGetAsyncEnumerator
pattern match, andIAsyncEnumerable<T>
is in type parameter's effective interfaces set.
Currently, IAsyncEnumerable<T>
is used even if there is a GetAsyncEnumerator
pattern (available through an interface) - see sharplab.io.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An
await foreach
statement will recognize and use implementation ofIAsyncEnumerable<T>
interface when collection is a type parameter that
allows ref strict
, there is noGetAsyncEnumerator
pattern match, andIAsyncEnumerable<T>
is in type parameter's effective interfaces set.Currently,
IAsyncEnumerable<T>
is used even if there is aGetAsyncEnumerator
pattern (available through an interface) - see sharplab.io.
I can see how this could be confusing, but there is no pattern match in this case due to an ambiguity.
Co-authored-by: Charles Stoner <[email protected]>
…tatements (#72810) Corresponding spec update - dotnet/csharplang#8024
No description provided.