<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I see model of <font face="monospace, monospace">Type<T></font> as follows:</div><div><ol><li>Values of <font face="monospace, monospace">Type<T></font> are identifiers of types (8 bytes, I guess)<br></li><li>All used identifiers are contained in <font face="monospace, monospace">Type<Any></font><br></li><li><font face="monospace, monospace">Type<T></font> contains a subset of those identifiers<br></li><li><font face="monospace, monospace">Type<T></font> are usually created with default constructor <font face="monospace, monospace">Type<T>()</font><br></li><li>Upcasting uses constructor <font face="monospace, monospace">init<U: T>(upcasting: Type<U>)</font><br></li><li>Checking for conformance uses method <font face="monospace, monospace">isSubtype(of:)</font><br></li><li>Size of <font face="monospace, monospace">Type<Type<T>></font> is 8, static size of <font face="monospace, monospace">Type<SomeProtocol></font> is 0</li></ol></div></div><div class="gmail_quote">2016-07-13 18:25 GMT+03:00 Adrian Zubarev via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span>:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>
<p>a = SomeClass.self<br></p><pre><code>expectTrue(a as? Any.Type == SomeClass.self)
expectTrue(a as? AnyClass == SomeClass.self)
expectTrue(a as? SomeClass.Type == SomeClass.self)</code></pre></div></div></blockquote><div>That example just demonstrates syntax of metatypes and does not count.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><ul>
<li><p>What about <code>dynamicType</code>?</p></li></ul></div></div></blockquote><div>It should have the following signature:</div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">func dynamicType<T>(_ var: T) -> Type<T></font></div><div><br></div><div>To return Type<T> means to return an identifier of U: T<br></div></div></div></div>