I'm just playing around swift with playground.
This code compiled on beta 2 and previous, but not on beta 3 or beta 4:
var myArray = ["foo1", "foo2", "foo3"]
var myArray2 = myArray
myArray2 === myArray
myArray2 += "hello"
myArray2 === myArray
It states that Type [String] does not conform to protocol AnyObject.
On Swift blog we read that in b3:
Array has been completely redesigned to have full value semantics to match the behavior of Dictionary and String. Now a let array is completely immutable, and a var array is completely mutable.
So is it correct to say that we lost reference equality operator === for arrays?
Operator == is obviously not the same thing, since it compares the array elements.
===is only forclass(reference-type) andArrayisstruct(value-type) - Bryan Chen