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

Equality of ResizeArrays different in .NET and Fable #3718

Open
goswinr opened this issue Jan 26, 2024 · 1 comment
Open

Equality of ResizeArrays different in .NET and Fable #3718

goswinr opened this issue Jan 26, 2024 · 1 comment

Comments

@goswinr
Copy link
Contributor

goswinr commented Jan 26, 2024

The equality operator = returns true in Fable but false in .NET for structurally equal ResizeArrays.

let xs = ResizeArray([0;1;2])
let ys = ResizeArray([0;1;2])

printfn "ResizeArray: %b" (xs=ys) // true in Fable, false in .NET

let xxs = [|0;1;2|]
let yys = [|0;1;2|]

printfn "Array: %b" (xxs=yys) // true in both Fable and .NET

see REPL

I think this is because they are both compiled to the same JS array. No? If this is intentional then I am happy to update the docs about it (and about sorting too).

@ncave
Copy link
Collaborator

ncave commented Jan 26, 2024

@goswinr I don't think it's intentional, it's just that both are implemented with JS arrays, so there is no runtime distinction. We should be able to fix it at compile time, though.

@goswinr goswinr changed the title Equality or ResizeArrays different in .NET and Fable Equality of ResizeArrays different in .NET and Fable Jan 26, 2024
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

2 participants