<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Courier New";
        panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Courier;}
span.hljs-func
        {mso-style-name:hljs-func;}
span.hljs-keyword
        {mso-style-name:hljs-keyword;}
span.hljs-title
        {mso-style-name:hljs-title;}
span.hljs-params
        {mso-style-name:hljs-params;}
span.hljs-number
        {mso-style-name:hljs-number;}
span.hljs-builtin
        {mso-style-name:hljs-built_in;}
span.hljs-comment
        {mso-style-name:hljs-comment;}
span.hljs-class
        {mso-style-name:hljs-class;}
span.EmailStyle29
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">I’d be fine losing the ability to pass methods as escaping closures.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">I wouldn’t like losing the ability to pass methods as non-escaping closures, because I find this pattern pretty useful:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp; class MyViewController {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp;&nbsp;&nbsp;var records: [Record]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp;&nbsp;&nbsp;var visibleRecords: [Record] { return records.filter(isVisible) }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp; &nbsp;&nbsp;func isVisible(_ record: Record) -&gt; Bool {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // some logic here, maybe using other properties of `self`<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">&nbsp; }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:Calibri">Alex Johnson<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><a href="mailto:ajohnson@walmartlabs.com"><span style="color:#0563C1">ajohnson@walmartlabs.com</span></a><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">ajohnson on Slack</span><span style="font-size:11.0pt;font-family:Calibri"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">&lt;antony.zhilin@gmail.com&gt; on behalf of Anton Zhilin &lt;antonyzhilin@gmail.com&gt;<br>
<b>Date: </b>Saturday, March 4, 2017 at 1:45 AM<br>
<b>To: </b>&quot;swift-evolution@swift.org&quot; &lt;swift-evolution@swift.org&gt;<br>
<b>Cc: </b>Alex Johnson &lt;AJohnson@walmartlabs.com&gt;<br>
<b>Subject: </b>Re: [swift-evolution] Should explicit `self.` be required when providing method as closure?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<div>
<p style="margin:1.2em!important">I disagree with dropping function references in general, but I do agree with limiting partially applied method references.<o:p></o:p></p>
<p style="margin:1.2em!important">In <code><span style="font-size:10.0pt;font-family:Consolas;border:solid #EAEAEA 1.0pt;padding:0in;background:#F8F8F8">@escaping</span></code> arguments, adding
<code><span style="font-size:10.0pt;font-family:Consolas;border:solid #EAEAEA 1.0pt;padding:0in;background:#F8F8F8">self.</span></code> won’t add enough evidence that it actually creates a closure with capture.<br>
Even in non-escaping context, I find plain method references odd:<code><span style="font-size:10.0pt;font-family:Consolas;color:#333333;border:solid #CCCCCC 1.0pt;padding:6.0pt;background:#F8F8F8"><o:p></o:p></span></code></p>
<p style="margin:1.2em!important">2017-03-04 10:09 GMT&#43;03:00 David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;:<o:p></o:p></p>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin:1.2em!important">I encountered this precise memory leak in my code a few days ago, so I sympathize. A second solution would be to drop function references. I think a core team member suggested it on another thread.<o:p></o:p></p>
</blockquote>
</div>
<div>
<p class="MsoNormal"><span style="font-size:1.0pt">​<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>