<div dir="ltr">On <span style="font-size:12.800000190734863px">Thu, 26 Oct 2017 21:54:37 -0700 </span><span style="font-size:12.800000190734863px">Slava Pestov <</span><a href="mailto:spestov@apple.com" style="font-size:12.800000190734863px">spestov@apple.com</a><span style="font-size:12.800000190734863px">> wrote:</span><div><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 style="word-wrap:break-word;line-break:after-white-space"><div><br style="font-size:12.800000190734863px"><span class="gmail-il" style="font-size:12.800000190734863px">Closures</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">cannot</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">replace</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">all</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">uses</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">of</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">local</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">functions</span><span style="font-size:12.800000190734863px">. </span><span class="gmail-il" style="font-size:12.800000190734863px">Local</span><span style="font-size:12.800000190734863px"> </span><span class="gmail-il" style="font-size:12.800000190734863px">functions</span><span style="font-size:12.800000190734863px"> can be recursive, and have a generic parameter list.</span><br style="font-size:12.800000190734863px"></div><div><span style="font-size:12.800000190734863px"><br></span></div></div></blockquote><div><br></div><div><div>FTM, local functions do not help with "keep functions short" and "keep indentation level small" rules of thumb.<br></div></div><div><br></div><div>what are the actual benefits of local vs non local functions? locality principle? (define something where it is used). but we do not have it in much more important cases, say, with static variables - we have to declare them outside of functions. ditto for normal variables in extensions - no matter how carefully i group functions in individual extensions based on their purpose -- potentially in different files -- it all breaks once i need to add a single variable to that group which i have to to in the class itself.</div><div><br></div><div>what would be the damage if we remove local functions altogether, would we lose anything really useful? aside from the fact that "it is too late at this stage" i mean (which is appreciated).</div><div><br></div><div>Mike<br></div><div><br></div></div></div></div></div>