Fable icon indicating copy to clipboard operation
Fable copied to clipboard

Equality of ResizeArrays different in .NET and Fable

Open goswinr opened this issue 1 year ago • 1 comments

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

goswinr avatar Jan 26 '24 17:01 goswinr

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

ncave avatar Jan 26 '24 20:01 ncave