<div dir="ltr">On 14 November 2017 at 21:36, Mike Kluev <span dir="ltr"><<a href="mailto:mike.kluev@gmail.com" target="_blank">mike.kluev@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><div>it might cover well over 90% of use cases (by my "pessimistic" estimate)... if someone has a quick way to scan and analyse, say, github swift sources we may even know that current percentage number of real life usage.</div></div></div></div>
</blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">i did a quick & dirty search on github (queries below). here are some stats:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">1) "weak var" - 946K hits<br></div></div><div class="gmail_extra"><div class="gmail_extra"><br></div><div class="gmail_extra">2) "weak self" - 168K hits</div><div class="gmail_extra"><br></div><div class="gmail_extra">3) "weak" - 1127K hits</div><div class="gmail_extra"><br></div><div class="gmail_extra">the summ of "weak var" + "weak self" = 1114K hits</div><div class="gmail_extra"><br></div><div class="gmail_extra">number of "weak" - 1114K = 13K</div><div class="gmail_extra"><br></div><div class="gmail_extra">let's assume this 13K is for weak "something" which is not "self"</div><div class="gmail_extra"><br></div><div class="gmail_extra">number of "weak something" + "weak self" = 181K</div><div class="gmail_extra"><br></div><div class="gmail_extra">"weak self" = 168K / 181K = 93%</div><div class="gmail_extra"><br></div><div class="gmail_extra">"weak something" = 13K / 181K = 7%</div><div class="gmail_extra"><br></div><div class="gmail_extra">the search queries for those interested:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://github.com/search?utf8=%E2%9C%93&q=%22weak+var%22+filename%3A.swift&type=Code">https://github.com/search?utf8=✓&q=%22weak+var%22+filename%3A.swift&type=Code</a></div><div class="gmail_extra"><a href="https://github.com/search?utf8=%E2%9C%93&q=%22weak+self%22+filename%3A.swift&type=Code">https://github.com/search?utf8=✓&q=%22weak+self%22+filename%3A.swift&type=Code</a></div><div class="gmail_extra"><a href="https://github.com/search?utf8=%E2%9C%93&q=%22weak%22+filename%3A.swift&type=Code">https://github.com/search?utf8=✓&q=%22weak%22+filename%3A.swift&type=Code</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">note that you have to rerun the search multiple times until it settles around some number.</div><div class="gmail_extra">also note, you can't easily use [ ] or other punctuation in github builtin search.</div><div class="gmail_extra"><br></div><div class="gmail_extra">the stat suggests that in 90%+ real-life cases [weak self] is used so the "weak func" syntax sugar is worth to consider as an addition to this proposal.</div><div class="gmail_extra"><br></div><div>Mike</div><div><br></div></div></div>