<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 4, 2016, at 12:13 PM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Apr 4, 2016, at 11:00 AM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">Are there reasons that prevent using `Self` as a synonym for an instance's type name?<br class=""><br class="">Consider:<br class=""><br class="">struct MyStruct {<br class=""> static func foo() { print("foo") }<br class=""> func bar() {<br class=""> MyStruct.foo() // works<br class=""> self.dynamicType.foo() // works<br class=""> Self.foo() // error<br class=""> }<br class="">}<br class=""><br class="">Obviously, you can always name a type directly or use `self.dynamicType` but<br class="">neither solution does any favors for readability. Both approaches obscure intent,<span class="Apple-converted-space"> </span><br class="">especially as type names grow large: `MyExtremelyLargeTypeName.staticMember`,<br class="">for example. Plus, as Kevin B pointed out to me, `self.dynamicType.classMember` <br class="">and `TypeName.classMember` may not be synonyms in class types with non-final members.<br class=""><br class="">I'd like to see `Self.staticMember` introduced as a synonym for `TypeName.staticMember`.<br class=""></blockquote><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">There's the wrinkle of inheritance, as there so often is. `Self` inside a class scope already means "the dynamic class of 'self'", not "the type this declaration statically appears within". Now, we really ought to allow you to utter Self in the bodies of class methods too. It would be consistent to extend that courtesy to value types, where dynamic `Self` always matches the static type, from that principle.</span><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Joe</span></div></blockquote></div><br class=""><div class="">Would using another word or symbol fix that problem?</div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div></body></html>