Implements and Overrides relaxation
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
VB supports delegate relaxation. It's a great feature for smoothing over some of the rough edges of OOP. I use it, for example, to strongly type the `sender` parameter of my event handlers (which would otherwise need to be typed as object). It would be consistent to extend this flexibility to implementing interfaces and overriding methods.
```
Function GetEnumerator() As MyStructEnumerator
Implements IEnumerable.GetEnumerator, IEnumerable(Of T).GetEnumerator
```
Today the above won't compile and the user is forced to write 3 different methods which all delegate to the same thing. I'm sure there are other examples (`ICloneable` comes to mind but that interface is defunct).
It's even worse with overrides, particularly in cases where you want to override a base property or function with a more specific return type:
```
Class SyntaxNode
MustOverride ReadOnly Property Parent As SyntaxNode
End Class
Class VisualBasicSyntaxNode
Inherits SyntaxNode
Overrides ReadOnly Property Parent As VisualBasicSyntaxNode
End Class
```
Because you can't both override Parent and hide it you have to create these Core and Impl methods and it's just messy. VB can be more pragmatic here. It's a consistent extension of the language but need to lookout for more scenarios outside of Roslyn. There's an alternate proposal to this problem that involves overriding whole type families but that seems like more ceremony, not less.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.