I see model of Type<T> as follows: 1. Values of Type<T> are identifiers of types (8 bytes, I guess) 2. All used identifiers are contained in Type<Any> 3. Type<T> contains a subset of those identifiers 4. Type<T> are usually created with default constructor Type<T>() 5. Upcasting uses constructor init<U: T>(upcasting: Type<U>) 6. Checking for conformance uses method isSubtype(of:) 7. Size of Type<Type<T>> is 8, static size of Type<SomeProtocol> is 0
2016-07-13 18:25 GMT+03:00 Adrian Zubarev via swift-evolution < [email protected]>: > > a = SomeClass.self > > expectTrue(a as? Any.Type == SomeClass.self) > expectTrue(a as? AnyClass == SomeClass.self) > expectTrue(a as? SomeClass.Type == SomeClass.self) > > That example just demonstrates syntax of metatypes and does not count. > > - > > What about dynamicType? > > It should have the following signature: func dynamicType<T>(_ var: T) -> Type<T> To return Type<T> means to return an identifier of U: T
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
