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]: base(T) phase two #8871

Open
MadsTorgersen opened this issue Dec 12, 2024 · 0 comments
Open

[Proposal]: base(T) phase two #8871

MadsTorgersen opened this issue Dec 12, 2024 · 0 comments
Assignees
Milestone

Comments

@MadsTorgersen
Copy link
Contributor

base(T) phase two

Summary

We decided that the best design for the base(I).M feature would be that we lookup M in the interface type I, and the result must be accessible. Moreover, there is a requirement that if the found member is abstract, the type I must have a unique most specific (concrete) implementation in the type I. The compiler would emit IL that identifies the method found, and the type I, and the runtime would select the most specific (concrete) implementation in the type I and invoke it (or throw an exception if there is no unique most specific implementation at runtime). There is no IL defined today that would serve this purpose, so we would have to design it. (One option would be to generate a "constrained" prefix with the interface type I). The IL should not assume or require that the implementing method is accessible to the caller (e.g. it could be private), but it does require that the declared method named in the IL is accessible.

Design meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2019/LDM-2019-02-27.md
https://github.com/dotnet/csharplang/blob/main/meetings/2019/LDM-2019-04-29.md#default-interface-implementations-and-base-calls

@MadsTorgersen MadsTorgersen added this to the Backlog milestone Dec 12, 2024
@MadsTorgersen MadsTorgersen self-assigned this Dec 12, 2024
@dotnet dotnet locked and limited conversation to collaborators Dec 12, 2024
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