I suggest you ...

Provide covariance/contravariance language support with syntaxes in F# in sync with covariance/contravariance in C#/VB

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:

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.

50 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Eriawan Kusumawardhono shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

There is a new community-driven user voice site for managing suggestions specifically related to the F# language design. https://fslang.uservoice.com/forums/245727-general

Please move this item there and link back to this entry, as the Visual Studio User Voice site is best used for suggestions related to the Visual F# Tools (rather than the language itself).

Don Syme, for the Visual F# Tools team


Sign in
Sign in with: facebook google
Signed in as (Sign out)

Feedback and Knowledge Base