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

C# 7.x 15.15.1 standard library task types #844

Closed
KalleOlaviNiemitalo opened this issue Jul 12, 2023 · 2 comments · Fixed by #846
Closed

C# 7.x 15.15.1 standard library task types #844

KalleOlaviNiemitalo opened this issue Jul 12, 2023 · 2 comments · Fixed by #846
Assignees
Milestone

Comments

@KalleOlaviNiemitalo
Copy link
Contributor

KalleOlaviNiemitalo commented Jul 12, 2023

Describe the bug

In the C# 7 draft, 15.15.1 says

(The Standard library types System.Threading.Tasks.Task<T> and types constructed from System.Threading.Tasks.Task are task types.)

However, there cannot be any types constructed from System.Threading.Tasks.Task, because it is not a generic type.

Example

None

Expected behavior

(The Standard library type System.Threading.Tasks.Task and types constructed from System.Threading.Tasks.Task<T> are task types.)

Additional context

Could also mention ValueTask and ValueTask<T>, which are listed in C.3 (Standard Library Types not defined in ISO/IEC 23271).

C.3 is inconsistent on whether the type parameter of these is named T or TResult. This name is not used when referencing the type in C#, but it is stored in the ECMA-335 GenericParam table and may be readable by reflection.

@jskeet
Copy link
Contributor

jskeet commented Jul 12, 2023

Hmm... it's interesting that we mention ValueTask at all. The only references are in basic concepts (where we say it doesn't count for a return type in async entry points) and in the standard library. I think I'll leave that inconsistency for now, but fix the generic issue and make it Task<TResult> everywhere.

jskeet added a commit to jskeet/csharpstandard that referenced this issue Jul 12, 2023
- Use `Task<TResult>` everywhere instead of `Task<T>`
- Fix typo around which type is generic and which isn't

Fixes dotnet#844.
@jskeet jskeet self-assigned this Jul 12, 2023
@jskeet jskeet added this to the C# 7.x milestone Jul 12, 2023
@KalleOlaviNiemitalo
Copy link
Contributor Author

ValueTask and ValueTask<TResult> will be needed in C# 8 async streams #606: IAsyncDisposable has a method ValueTask DisposeAsync();, and IAsyncEnumerator<out T> has a method ValueTask<bool> MoveNextAsync();. I don't think C# 7 requiring ValueTask and ValueTask<TResult> would be too much of a burden to implementors.

jskeet added a commit to jskeet/csharpstandard that referenced this issue Jul 12, 2023
- Use `Task<TResult>` everywhere instead of `Task<T>`
- Fix typo around which type is generic and which isn't

Fixes dotnet#844.
jskeet added a commit to jskeet/csharpstandard that referenced this issue Jul 12, 2023
- Use `Task<TResult>` everywhere instead of `Task<T>`
- Fix typo around which type is generic and which isn't

Fixes dotnet#844.
jskeet added a commit that referenced this issue Jul 12, 2023
- Use `Task<TResult>` everywhere instead of `Task<T>`
- Fix typo around which type is generic and which isn't

Fixes #844.
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 a pull request may close this issue.

2 participants