Array reference equality in Xcode 6 b3/b4 -
I am playing fast with the playing field.
This code is compiled at beta 2 and previous but not beta 3 or beta 4:
var myArray = ["foo1", "foo2", "foo3 "] Var myArray2 = myArray myArray2 === myArray myArray2 + =" Hello "MyArray2 === myArray indicates that type [string] corresponds to any object protocol Not . We read on it b3:
The arrays have been completely changed to keep the semantics full value to match the behavior of the dictionary and string. Now an array is completely immutable, and a var array is completely unstable.
So it is right to say that we have lost reference equality operator === arrays? Operator == is not obvious, because it compares array elements.
Yes it is fair to say that we lost === for array Given the true true value of value , which means that they always make a copy when assigned to a new variable. This code is useless because it is never true. The reference type (or class) is the only place where === is understood because they are the only ones with two variables context This may be the reason that the error says that the array does not correspond to the protocol object AnyObject is a protocol for all classes.
Comments
Post a Comment