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

[Proposal]: Partial Type Inference #8968

Open
RikkiGibson opened this issue Jan 6, 2025 · 0 comments
Open

[Proposal]: Partial Type Inference #8968

RikkiGibson opened this issue Jan 6, 2025 · 0 comments
Assignees
Milestone

Comments

@RikkiGibson
Copy link
Contributor

Discussion: #8967

See #1348
See also #7582

Currently, in an invocation of a generic method, you either have to specify all of the type arguments or none of them, in the latter case depending on the compiler to infer them for you. The proposal is to permit the programmer to provide some of the type arguments, and have the compiler infer only those that were not provided.

There are (at least) three possible forms this could take:

  1. Named type arguments (Discussion: Named type arguments #280, Proposal: Allow partial generic specification #1348), e.g. M<TElement: int>(args)
  2. Omitted type arguments separated by commas, e.g. M<int, >(args)
  3. Types to be inferred specified by var (Proposal: Allow partial generic specification #1348), e.g. M<int, var>(args)

Design Meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-02-07.md#partial-type-inference

@RikkiGibson RikkiGibson self-assigned this Jan 6, 2025
@dotnet dotnet locked and limited conversation to collaborators Jan 6, 2025
@RikkiGibson RikkiGibson added this to the Any Time milestone Jan 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant