Skip to content
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

Generic equality should use the SetEquals method #1335

Open
6 tasks
xp44mm opened this issue Nov 13, 2023 · 2 comments
Open
6 tasks

Generic equality should use the SetEquals method #1335

xp44mm opened this issue Nov 13, 2023 · 2 comments

Comments

@xp44mm
Copy link

xp44mm commented Nov 13, 2023

I propose we ... (describe your suggestion here)

In .net runtime, there are many Set types that all have SetEquals methods. Generic equality should use the SetEquals method.

    let x = HashSet [1;2;3]
    let y = HashSet [1;2;3]
    Console.WriteLine($"{x=y}")  // false
    Console.WriteLine($"{x.SetEquals y}") // true

The existing way of approaching this problem in F# is ...

Pros and Cons

The advantages of making this adjustment to F# are ...

The disadvantages of making this adjustment to F# are ...

Extra information

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

Related suggestions: (put links to related suggestions here)

Affidavit (please submit!)

Please tick these items 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
  • This is a language change and not purely a tooling change (e.g. compiler bug, editor support, warning/error messages, new warning, non-breaking optimisation) belonging to the compiler and tooling repository
  • 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
  • I have searched both open and closed suggestions on this site and believe this is not a duplicate

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

For Readers

If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.

@smoothdeveloper
Copy link
Contributor

If this would come, the default analyzers that ship with the compiler should know about it:

if the langversion is < 9 and the fsharp.core version which ships this is used, it should hint that there is a breaking change in behaviour.

We should also consider generating fsproj with the fixed language version rather than latest, if we want to be super conservative and help people be the same, by default, and improve error message when features of new version would make some code compile, but it fails to compile:

Whenever a language version check is done in the compiler leading to an error, through some magic (of algebraic effect, or side, or changing SupportsFeatures call to keep track of things), it would add a final error message showing which language feature check was hit, and mention it in error message, encouraging user to adjust the language version setting.

@Happypig375
Copy link
Contributor

Easily fixed with #1280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants