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:
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.

50 votes
Vote
Sign in
(thinking…)
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

2 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base