Replies: 2 comments
-
Is there an option to keep both versions of extensions around in an non-binary-compatible and non-interoperable manner, but migrate codebases forwards with a attributes and potentially code fixers to update code to new extensions plus source generators to generate the old-style extension methods? e.g. something like: [ExtensionMethodsTypeName("EExtensions")]
extension E for T
{
public void Foo() => throw null;
[GenerateExtensionMethod]
public void Bar() => throw null;
}
// Generates something like:
static class EExtensions
{
[OverloadResolutionPriority(-1)]
[EditorBrowsable(Never)]
public static void Bar(this T self) => self.Bar();
} |
Beta Was this translation helpful? Give feedback.
-
I mostly like the new proposal for the per-member syntax, but I'm not convinced about the need for the new
In my opinion, the cons outweigh the pros here. It's yet another new "type" keyword, will cause confusion about why/how its different from The disambiguation syntax I think needs to go back to the drawing board. It is super confusing to have an apparent type-cast for something that is not a type. "Extension properties" et al, will really just be static methods with syntax sugar- so why not just generate them as human-callable names and let them be called as static methods if a user really needs to disambiguate? Eg, My vote is to stick with the existing |
Beta Was this translation helpful? Give feedback.
-
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-10-09.md
Agenda
Beta Was this translation helpful? Give feedback.
All reactions