<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> NSObject<br> NSResponder: NSObject<br> NSView: NSResponder<br><br>`Type<NSResponder>` is a `Subtype<NSObject>`, but not a `Subtype<NSView>`.<br><br>Thus, this reads correctly:<br><br> let aType: Subtype<NSResponder> = NSView.self<br><br>Whereas this does not:<br><br> let aType: Supertype<NSResponder> = NSView.self</span></font><br></blockquote></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Calling it SuperTypeOf<T> and SubTypeOf<T> 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 <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> 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 <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> 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> func type<T>(of: T) -> Type<T></span><br><span> func subtype<T>(of: T) -> Subtype<T></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<T>` 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<T> should be a supertype of Type<T> 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<T>` instead of `Metatype<T>`.)</span><br><span></span><br><span>Every instance of `Subtype<T>` is the type instance for a subtype of `T`. For instance, in this hierarchy:</span><br><span></span><br><span> NSObject</span><br><span> NSResponder: NSObject</span><br><span> NSView: NSResponder</span><br><span></span><br><span>`Type<NSResponder>` is a `Subtype<NSObject>`, but not a `Subtype<NSView>`.</span><br><span></span><br><span>Thus, this reads correctly:</span><br><span></span><br><span> let aType: Subtype<NSResponder> = NSView.self</span><br><span></span><br><span>Whereas this does not:</span><br><span></span><br><span> let aType: Supertype<NSResponder> = 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>