Great explanation.<br><br>Can you elaborate on your two reasons for the proposed Type<T>?<br><br>In particular, what do you mean by inheritable and non-inheritable members of T? Where do these come into play? How is the current T.Type deficient in this respect?<br><br>Regarding (2), it is already possible to do precise type matches using `==` instead of `is` (see corelibs-foundation for extensive uses). What does the proposal offer that goes beyond what we currently have?<br><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 29, 2016 at 22:57 Brent Royal-Gordon <<a href="mailto:brent@architechies.com">brent@architechies.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> On Sep 29, 2016, at 8:14 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
><br>
> 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)?<br>
<br>
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:<br>
<br>
func type<T>(of: T) -> Type<T><br>
func subtype<T>(of: T) -> Subtype<T><br>
<br>
And I'm saying that, given these names, `type(of:)` is confusing and near-useless, whereas `subtype(of:)` is what you almost always want.<br>
<br>
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.<br>
<br>
> 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?<br>
<br>
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>`.)<br>
<br>
Every instance of `Subtype<T>` is the type instance for a subtype of `T`. For instance, in this hierarchy:<br>
<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<br>
<br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br>
</blockquote></div>