On 14 November 2017 at 21:36, Mike Kluev <[email protected]> wrote:
> > 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. > i did a quick & dirty search on github (queries below). here are some stats: 1) "weak var" - 946K hits 2) "weak self" - 168K hits 3) "weak" - 1127K hits the summ of "weak var" + "weak self" = 1114K hits number of "weak" - 1114K = 13K let's assume this 13K is for weak "something" which is not "self" number of "weak something" + "weak self" = 181K "weak self" = 168K / 181K = 93% "weak something" = 13K / 181K = 7% the search queries for those interested: https://github.com/search?utf8=✓&q=%22weak+var%22+filename%3A.swift&type=Code <https://github.com/search?utf8=%E2%9C%93&q=%22weak+var%22+filename%3A.swift&type=Code> https://github.com/search?utf8=✓&q=%22weak+self%22+filename%3A.swift&type=Code <https://github.com/search?utf8=%E2%9C%93&q=%22weak+self%22+filename%3A.swift&type=Code> https://github.com/search?utf8=✓&q=%22weak%22+filename%3A.swift&type=Code <https://github.com/search?utf8=%E2%9C%93&q=%22weak%22+filename%3A.swift&type=Code> note that you have to rerun the search multiple times until it settles around some number. also note, you can't easily use [ ] or other punctuation in github builtin search. 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. Mike
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
