<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>There's something I find very confusing with this proposal, and it's how Self is already used in protocol definitions to represent the STATIC type of the type that conforms to the protocol. I think people will be potentially very confused by how Self represents different types in different contexts:<br></div><div><br></div><div>protocol Copyable {</div><div> func copy() -> Self</div><div>}</div><div><br></div><div>class Animal : Copyable {</div><div> init() {}</div><div> func copy() -> Animal {</div><div> return Self.init()</div><div> }</div><div>}<br><div><br></div><div id="AppleMailSignature">class Cat : Animal {}<br><br>In the previous sample, wouldn't it be confusing to people if Self in the protocol means Animal in the Animal type, but Self in the Animal type may mean Cat?</div><div id="AppleMailSignature"><br>Sent from my iPad</div>On 06 Apr 2016, at 18:51, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 5, 2016, at 4:04 PM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Apr 5, 2016, at 3:02 PM, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:<br class=""><br class="">As the discussion seems to be quieting down, I've tried to summarize the on-list discussion and distill it into a preliminary proposal draft. Please let me know if this covers what you think it should or if I've entirely missed the mark. (It wouldn't be the first time.)<br class=""><br class="">Regards, -- Erica<br class=""></blockquote></div></div></blockquote></div><div class=""><br class=""></div>Pull Request 248: <a href="https://github.com/apple/swift-evolution/pull/248" class="">https://github.com/apple/swift-evolution/pull/248</a><div class=""><br class=""></div><div class=""><p style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; margin-top: 0px !important;" class="">Within a class scope, <code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Self</code> means "the dynamic class of <code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">self</code>". This proposal extends that courtesy to value types, where dynamic <code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">Self</code> will match a construct's static type, and to the bodies of class members, where it may not. It also introduces a static variation, <code style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">#Self</code> that expands to static type of the code it appears within.</p><div style="box-sizing: border-box; margin-top: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; margin-bottom: 0px !important;" class="">This proposal was discussed on the Swift Evolution list in the <a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/13708/focus=13712" style="box-sizing: border-box; color: rgb(64, 120, 192); text-decoration: none;" class="">[Pitch] Adding a Self type name shortcut for static member access</a> thread.</div><div class=""><br class=""></div><div class="">Thanks, -- E</div><div class=""><br class=""></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>