<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Good point.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Again, from an educator perspective, one view is to think of the Class itself as a singleton object in memory, with its own set of iVars and methods that operate upon them. Although declared and defined in one source, when you visualise as objects / relationships in memory, one model is to see each instance as a small island with references back to a common shared singleton object (the class). </div><div id="AppleMailSignature">The prefix seems consistent with this model.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Now this may / may not match reality, but I find it's helpful to have that clear separation, especially for new learners, and Swift is a good entry language in this respect.</div><div id="AppleMailSignature">(Similarly I like the way closures sometimes force the developer to use the self prefix as well).</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><br>Sent from my iPad</div><div><br>On 1 Jul 2016, at 19:06, Kate Stone <<a href="mailto:k8stone@apple.com">k8stone@apple.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div><blockquote type="cite" class=""><div class="">On Jul 1, 2016, at 11:01 AM, Jens Alfke via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 1, 2016, at 10:28 AM, Nicholas Outram via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Alegreya-Regular; font-size: 15px; 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="">class methods may mutate "mutable static variables” (singletons), which are dangerous in multi-threaded code.</span></div></blockquote><br class=""></div><div class="">This is the same argument zh ao made. But instance methods may also mutate static variables, so the fact that you’re calling a class method doesn’t make the call any more dangerous.</div><div class=""><br class=""></div><div class="">Moreover, mutating <i class="">instance</i> variables can be just as dangerous for multithreaded code (and is a more frequent source of bugs IMHO).</div><div class=""><br class=""></div><div class="">Really, the only significant difference is that a class method <i class="">can’t</i> modify instance variables, so from that perspective it’s actually a bit safer than an instance method call!</div></div></div></blockquote><div><br class=""></div><div>Though that isn’t strictly true for singleton patterns and other reasons why class variables might include references to instances.</div></div><div class=""><br class=""></div>I believe there’s real value in being explicit about referencing class members. It helps both the reader of the code and it makes writing code with typical IDE conveniences like code completion less cluttered and more informative. Unfamiliar class methods won’t be included in lists of suggestions where they might look like they operate on the current instance.<div class=""><br class=""><div class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="" style="font-family: LucidaGrande; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><font color="#424242" class="" style="font-family: 'Lucida Grande'; font-size: x-small;">Kate Stone</font><span class="" style="font-family: 'Lucida Grande'; font-size: x-small;"> </span><font color="#009193" class="" style="font-family: 'Lucida Grande'; font-size: x-small;"><a href="mailto:k8stone@apple.com" class="">k8stone@apple.com</a></font></div><div class="" style="font-family: Times; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><font face="Lucida Grande" size="1" class=""><font color="#009193" class=""></font> Xcode <font color="#424242" class="">Low Level Tools</font></font></div></div></div></div></div></div></div><br class=""><div><blockquote type="cite" class=""></blockquote></div></div></div></div></blockquote></body></html>