<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hey Brent,</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Sorry for being a bit dense about this, but...</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><blockquote type="cite"><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><br>&nbsp; &nbsp;NSObject<br>&nbsp; &nbsp;NSResponder: NSObject<br>&nbsp; &nbsp;NSView: NSResponder<br><br>`Type&lt;NSResponder&gt;` is a `Subtype&lt;NSObject&gt;`, but not a `Subtype&lt;NSView&gt;`.<br><br>Thus, this reads correctly:<br><br>&nbsp; &nbsp;let aType: Subtype&lt;NSResponder&gt; = NSView.self<br><br>Whereas this does not:<br><br>&nbsp; &nbsp;let aType: Supertype&lt;NSResponder&gt; = NSView.self</span></font><br></blockquote></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Calling it SuperTypeOf&lt;T&gt; and SubTypeOf&lt;T&gt; would make it less confusing as that is how I read it in my mind in your last example.<br><br>Sent from my iPhone</div><div><br>On 30 Sep 2016, at 04:57, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><blockquote type="cite"><span>On Sep 29, 2016, at 8:14 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I'm confused by this explanation.Today, `type(of:)` is the new `.dynamicType`. Is this proposal suggesting a silent change so that it now returns the static type? If so, why (particularly when you explain that this is often *not* what you would want)?</span><br></blockquote><span></span><br><span>I'm short-handing the names to talk about the return values. In other words, I assume that, if we have both `type(of:)` and `subtype(of:)`, their signatures would be:</span><br><span></span><br><span> &nbsp; &nbsp;func type&lt;T&gt;(of: T) -&gt; Type&lt;T&gt;</span><br><span> &nbsp; &nbsp;func subtype&lt;T&gt;(of: T) -&gt; Subtype&lt;T&gt;</span><br><span></span><br><span>And I'm saying that, given these names, `type(of:)` is confusing and near-useless, whereas `subtype(of:)` is what you almost always want.</span><br><span></span><br><span>We *could*, of course, have a function called `type(of:)` which returned `Subtype&lt;T&gt;` and had the semantics I'm referring to as `subtype(of:)`. A name is just a name.</span><br><span></span><br><blockquote type="cite"><span>I'm also somewhat puzzled about the proposed design. This proposal explains that Subtype&lt;T&gt; should be a supertype of Type&lt;T&gt; and its subtypes. Why is a supertype named Subtype?</span><br></blockquote><span></span><br><span>Because a type's name should describe the *instances*; that's why you don't put "Class" at the end of all of your class names. (It's also why we're proposing `Type&lt;T&gt;` instead of `Metatype&lt;T&gt;`.)</span><br><span></span><br><span>Every instance of `Subtype&lt;T&gt;` is the type instance for a subtype of `T`. For instance, in this hierarchy:</span><br><span></span><br><span> &nbsp; &nbsp;NSObject</span><br><span> &nbsp; &nbsp;NSResponder: NSObject</span><br><span> &nbsp; &nbsp;NSView: NSResponder</span><br><span></span><br><span>`Type&lt;NSResponder&gt;` is a `Subtype&lt;NSObject&gt;`, but not a `Subtype&lt;NSView&gt;`.</span><br><span></span><br><span>Thus, this reads correctly:</span><br><span></span><br><span> &nbsp; &nbsp;let aType: Subtype&lt;NSResponder&gt; = NSView.self</span><br><span></span><br><span>Whereas this does not:</span><br><span></span><br><span> &nbsp; &nbsp;let aType: Supertype&lt;NSResponder&gt; = NSView.self</span><br><span></span><br><span>-- </span><br><span>Brent Royal-Gordon</span><br><span>Architechies</span><br><span></span><br><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>