New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map and `dict` should implement `IReadOnlyDictionary<'Key,'Value>` #622

Closed
baronfel opened this Issue Nov 17, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@baronfel
Collaborator

baronfel commented Nov 17, 2017

Support IReadOnlyDictionary<'Key,'Value> on dict and Map types

I propose we extend the types/functions above to implement IReadOnlyDictionary to provide an easy way to abstract across those types from C# code and still provide the non-mutable semantics we expect from those types.

The existing way of approaching this problem in F# is to turn either of those types into a Dictionary<,> and then cast to IReadOnlyDictionary

Pros and Cons

The advantages of making this adjustment to F# are being more clear on the intended semantics of core types and helper functions.

The disadvantages of making this adjustment to F# are potentially having to conditionally compile the implementation if the compiler targets a version of .Net that doesn't include the interface (.Net Framework < 4.5 I believe).

Extra information

Estimated cost (XS, S, M, L, XL, XXL): S

Related suggestions: (put links to related suggestions here)

Affidavit (please submit!)

Please tick this by placing a cross in the box:

  • This is not a question (e.g. like one you might ask on stackoverflow) and I have searched stackoverflow for discussions of this issue
  • I have searched both open and closed suggestions on this site and believe this is not a duplicate
  • This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it.

Please tick all that apply:

  • This is not a breaking change to the F# language design
  • I or my company would be willing to help implement and/or test this
@dsyme

This comment has been minimized.

Show comment
Hide comment
@dsyme

dsyme Nov 23, 2017

Collaborator

Labelling as approved

Collaborator

dsyme commented Nov 23, 2017

Labelling as approved

@saul

This comment has been minimized.

Show comment
Hide comment
@saul

saul commented Nov 25, 2017

@dsyme

This comment has been minimized.

Show comment
Hide comment
@dsyme

dsyme Dec 1, 2017

Collaborator

Closing in favour of #624 which can cover this too

Collaborator

dsyme commented Dec 1, 2017

Closing in favour of #624 which can cover this too

@dsyme dsyme closed this Dec 1, 2017

@dsyme dsyme removed the needs rfc label Dec 1, 2017

@cartermp cartermp added completed and removed started labels Jun 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment