Re: [swift-users] object.self?

2016-07-09 Thread Austin Zheng via swift-users
Yes, as far as I know 'foo' and 'foo.self' are equivalent. I don't actually know why the latter exists, except in analogy to "T.self". There was a mistake in my response; the metatype of 'foo' is not 'foo.self', it is 'foo.dynamicType' (or whatever new form dynamicType is going to take in Swift

Re: [swift-users] object.self?

2016-07-09 Thread Rick Mann via swift-users
> On Jul 8, 2016, at 09:45 , Austin Zheng wrote: > > Hi Rick, > > If you have a type (let's call it "T"), you can use it two ways: > > * As a type, or part of a type, like such: "let x : T = blah()" > * As a value, just like any other variable, function argument,

Re: [swift-users] object.self?

2016-07-08 Thread Austin Zheng via swift-users
Hi Rick, If you have a type (let's call it "T"), you can use it two ways: * As a type, or part of a type, like such: "let x : T = blah()" * As a value, just like any other variable, function argument, property, etc. In the second case (type-as-value), you need to append ".self" to the type name

[swift-users] object.self?

2016-07-08 Thread Rick Mann via swift-users
I just saw a question which brought up something I didn't know about. Apparently sometimes you have to call object.self in a place that looks like you should just use "object." What does this usage mean? for subclassObject in objects { switch subclassObject.self {<--- Here, why not