I think I am missing a point, as in my tests it seems the behavior of "===" doesn't comply to the documentation.
The documentation states "First the types of x and y are compared. If those are identical, mutable objects are compared by address in memory and immutable objects (such as numbers) are compared by contents at the bit level".
I understand from this definition is that :
- for mutable objects, two distincts objects (ie. different memory address) should not be "
===" - for immutable objects, when the contents are identical, they should be "
==="
However :
The Sets are immutable, but two identical objects by the content are not "==="
set1 = Set(["S"])
set2 = Set(["S"])
ismutable(set1)
Returns false
set1 === set2
Returns false, but according to the documentation should return true, as set1 and set2 are two immutable objects with identical contents. (or ismutable(set1) should return true?)
The Strings are mutable, but two distinct objects are "==="
string1 = String("test")
string2 = String("test")
ismutable(string1)
Returns true
string1 === string2
Returns true, but according to the documentation should return false as string1 and string2 are two distinct mutable objects, and hence their address in memory should be different. (or ismutable(string1) should return false?)
What is the point I am missing ?