-
Couldn't load subscription status.
- Fork 22
Description
Submitted by Eriawan Kusumawardhono on 3/21/2014 12:00:00 AM
150 votes on UserVoice prior to migration
Covariance/contravariance has its beginning in CLR 2.0 and also with the introduction of generics in .NET 2.0 (also in F#, C# and VB)
Then in C# 4.0 and VB 10, we have covariance/contravariance supports in the language itself. Currently we don't have support for these covariance and contravariance in F#.
I know it is a runtime feature of CLR 2.0 and 4.0 and I don't want to play catch up with C# and VB.
But this covariance/contravariance support in C# and VB are powerful to use and also have proven to provide cleaner and clearer ways to understand the code and variances in the types, especially when using parameterized generic types.
This is not the same as this feedback:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2363794-ocaml-like-variance-annotations-a-and-a-
but we can use that OCaml syntax as well for starter.
This feature should also be constrained to only use covariance/contravariance in interfaces and delegates just like in C# and VB, but F# may provide more supports for other types such as events.
An example of this is the way F# has provided the capability to create extensions to properties and methods, not just methods only in C# and VB.