<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><blockquote type="cite" class="">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=""></blockquote>[...]<br class=""><blockquote type="cite" class=""><br class="">I'd like to see `Self.staticMember` introduced as a synonym for `TypeName.staticMember`.<br class=""></blockquote><br class="">I would love to see a way to get the type of the "enclosing thing at compile time”. In my particular case, I’m using the type as a generic parameter to tag a created resource with something like:<br class=""><br class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">class Client: PropertyOwner {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let intProperty = Client.property(“name”, Int(0))<br class="">}</blockquote><br class="">where PropertyOwner has a static property<Owner, DataType>(...)<br class=""><br class="">With `Self` meaning the static version of the thing being compiled, I could at least write:<br class=""><br class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">class Client: PropertyOwner {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let intProperty = Self.property(“name”, Int(0))<br class="">}</blockquote><br class="">which would have the benefit of being harder to mess up due to copy-pasting between different PropertyOwner implementors.<div class=""><br class=""></div><div class="">I would love to be able to omit the `Self.` entirely, but instances can’t call functions on themselves at init time, and instances don’t see static funcs, so that probably won’t fly =)</div><div class=""><br class=""></div><div class="">The particular spelling of ‘static self` doesn’t matter too much to me, so if `Self` needs to be the runtime type of the executing class then maybe `StaticSelf` could be added.</div><div class=""><br class=""></div><div class="">-tim</div><div class=""><br class=""></div></body></html>