-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
System.Runtime.CompilerServices.RuntimeFeature.VirtualStaticsInInterfaces #49905
Comments
I assume this gets attributed as [Preview] as well? |
@jcouv I agree with @stephentoub that this constant should be marked with the preview attribute. Do we think that the IsSupported function result should also be conditional on the runtime preview flag being set as well? |
I think marking it as It is also okay to have the Neither seems needed for preview 5. I'm not sure what's the best way to track such a change (once the design of preview flag is done). I'll add a note in roslyn work items for now. |
Why are we adding this API? The compiler will use the string literal because it does not target net6, right? |
Like |
Looks good as-is (with the RequiresPreviewFeatures attribute) namespace System.Runtime.CompilerServices
{
public static class RuntimeFeature
{
[RequiresPreviewFeatures]
public const string VirtualStaticsInInterfaces = nameof(VirtualStaticsInInterfaces);
}
} |
Notably, as raised by @333fred, this may need to be changed to The library team has stated that default implementation support will be eventually required (at least by v2) so we can add members to existing interfaces such as CC. @davidwrighton and @AlekseyTs to determine when that support will go in and whether that has any impact for what we use in .NET 6 vs when the feature ships as stable (v1) vs when we need to version the interfaces (v2) |
I think its highly likely that default implementation support will ship in the runtime, even if it doesn't make the language. |
I am not sure how runtime would be able to do that since specification doesn't define a way to describe that in metadata. I believe according to specification, virtual statics in interfaces can be only abstract, which doesn't allow them to have an implementation. |
My expectation is that we'll take an update to our spec in time for Preview 6. There have been enough consistent ask from @tannergooding for this during the feature, that I'd like to take a stab at the design so that the runtime work in .NET 7 to move this from a preview feature is performance focused and not behavior focused. |
The runtime should expose the following feature flag for runtimes that support static abstract members in interfaces.
The implementation of
static bool IsSupported(string feature)
should be updated accordingly.FYI @davidwrighton @AlekseyTs
Relates to language feature: dotnet/csharplang#4436
Per discussion with the overall feature crew, we'd like this change in .NET 6 preview 5, to line up with runtime and C# compiler work.
The text was updated successfully, but these errors were encountered: