You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LanguagePrimitives.PhysicalEquality in F# returns true when two object references refer to the same underlying object.
There are equivalents to this, namely === in JS and is in python. While the call gets transpiled to use === in JS, in python it is transpiled into ==, leading to different results.
letr1= ResizeArray([1;2])letr2= ResizeArray([1;2])letr3= r1
printfn "%A"(LanguagePrimitives.PhysicalEquality r1 r2)// false, both arrays are instantiated seperately
printfn "%A"(LanguagePrimitives.PhysicalEquality r2 r2)// true, refers to the same thing
printfn "%A"(LanguagePrimitives.PhysicalEquality r3 r1)// true, refers to the same thing via reference assignment
Expected and actual results
Should print
false
true
true
(and does so in F# and JS)
But prints
true
true
true
The text was updated successfully, but these errors were encountered:
Description
LanguagePrimitives.PhysicalEquality
in F# returnstrue
when two object references refer to the same underlying object.There are equivalents to this, namely
===
in JS andis
in python. While the call gets transpiled to use===
in JS, in python it is transpiled into==
, leading to different results.Repro code
See also this REPL
Transpiling this code
Expected and actual results
Should print
(and does so in F# and JS)
But prints
The text was updated successfully, but these errors were encountered: