In Xcode 7 beta 2, we'll get the following new compile time error:
let MyIntSomething = Int.self
let b = MyIntSomething(123) // Error: Initializing from a metatype must reference 'init' explicitly
// let b = MyIntSomething.init(123) // (So this will work.)And/but according to the iBook:
A metatype referes to the type of any type, including class types, structure types, enumeration types, and protocol types. /.../ You can use the postfix self expression to access a type as a value. For example, SomeClass.self returns SomeClass itself, not an instance of SomeClass.
If MyIntSomething is the Int type itself (as the iBook says), why can't we do this:
let b: MyIntSomething = 123?
And if it is a metatype (as the error message says) why doesn't the iBook say anything about SomeType.self returning a metatype and instead says it returns the type itself as a value (and also it says nothing about type objects as the beta 2 release notes does in relation to this)?
I'd like to know what MyIntSomething is. Is it a metatype (as the error message says) or is it the Int type itself (as the iBook says) or is it both?
Or/and is it a type object as opposed to a type name, if so what is the difference?
Where can I get some more substantial information about all this, preferably with lots of interesting use cases?