[swift-evolution] [Pitch] Rename `x.dynamicType` to `x.Self`

Brandon Knope bknope at me.com
Fri Apr 15 14:44:44 CDT 2016


I'm just concerned about the obviousness of it. If what we are doing is just grabbing the type, why couldn't it be:

someClass.Type (like in the generic system)

I'm open to Self, but I just want to make sure we exhaust all avenues that are more obvious at a glance:

.Self.Type
.ThisType
.SelfType
.Type

SelfType is redundant but it also more obvious at first look. 

Maybe it doesn't matter and I am caring about the looks of it too much. Because so many people seem to support .Self in this thread, it might just be me and something I need to accept :P

Brandon 



> On Apr 15, 2016, at 1:19 PM, Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> On Apr 14, 2016, at 11:59 AM, Brandon Knope <bknope at me.com> wrote:
>> 
>> -1 from me. To me this is not *obvious* as to what "Self" it means. 
>> 
>> And it seems possible to run into this: 
>> self.someClass.Self
>> 
>> Just looks confusing to me. What's wrong with using "Type" or something more obvious?
> 
> That's a fair point. On the other hand, I think we're pretty consistent now about using CapitalizedCamelCase for types and lowerCamelCase for non-types, so while we could rename Self to SelfType, that feels a bit redundant to me if you've already internalized "caps == types".
> 
> -Joe


More information about the swift-evolution mailing list