<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=""><div>imho the most valuable vote for mandatory self, just one comment on it&nbsp;</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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;">1) Accessing a property, in a class, is more expensive than accessing a local variable. The above code would require three message sends and/or vtable accesses instead of one, if it were not assigning the property to a local variable. These unnecessary property accesses needlessly reduce the efficiency of the program.</div></div></blockquote></div>True for Objective-C, and might be true for Swift in many cases as well - but just because of legacy reasons:<div class="">Correct me if I'm wrong, but I expect that simple getters have no performance penalty at all.</div><div class="">Nonetheless, you can't see how expensive the access is, and the effects in multi-threaded environments are a real issue - but those two reasons are no argument for mandatory self, but rather against it:</div><div class="">When there are issues with repetitive access, you can just insert a "let foo = self.foo", and the problem is gone; you can't do so when you already referenced the variable with "self.foo" all over the place.</div><div class="">This is imho one of the most important lessons to learn from this thread:</div><div class="">Just don't give your variables confusing names, unless you have good reason to do so!</div><div class=""><br class=""></div><div class="">Best regards,</div><div class="">Tino</div><div class=""><br class=""></div><div class="">p.s.:</div><div class="">I've have read an article that advises not to cache getters at all - but couldn't remember or search a reference for this. Afair the proposal came from a Java-background - which fits to my memory that the possible performance problems weren't addressed ;-)</div></body></html>