<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>You are right of course.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"> I'm looking at this more from the eyes of an educator, where anything that reduces ambiguity helps. Students naively gravitating towards a singleton pattern is one of the battles I face. Some learners don't even properly understand the difference or risks. </div><div id="AppleMailSignature">Invoking a static method can <i>only</i> mutate shared memory, making it a simple candidate for dangerous practise, so it's helpful when a language is explicit. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Ultimately you are right of course, as you say, instance methods can do this also. </div><div id="AppleMailSignature">(Maybe it's also my own personal style / bias as I tend to avoid referencing static variables from instance methods where possible)</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Good discussion!</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><br>Sent from my iPad</div><div><br>On 1 Jul 2016, at 19:01, Jens Alfke <<a href="mailto:jens@mooseyard.com">jens@mooseyard.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><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>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><br class=""></div><div>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><br class=""></div><div>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><br class=""></div><div>—Jens</div></div></blockquote></body></html>