<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}

h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}

h1 {
        color: #000000;
        font-size: 28pt;
}

h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}

h3 {
        font-size: 18px;
}

h4 {
        font-size: 16px;
}

h5 {
        font-size: 14px;
}

h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}

hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
    display: inherit;
}

p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}

a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}

#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}

button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}

code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}

code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}

pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}

pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}

#ws { background-color: #f8f8f8; }


.bloop_markdown table {
border-collapse: collapse;  
font-family: Helvetica, arial, freesans, clean, sans-serif;  
color: rgb(51, 51, 51);  
font-size: 15px; line-height: 25px;
padding: 0; }

.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
     
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }

.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }

.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }

.bloop_markdown blockquote{
  border-left: 4px solid #dddddd;
  padding: 0 15px;
  color: #777777; }
  blockquote > :first-child {
    margin-top: 0; }
  blockquote > :last-child {
    margin-bottom: 0; }

code, pre, #ws, #message {
    word-break: normal;
    word-wrap: normal;
}

hr {
    display: inherit;
}

.bloop_markdown :first-child {
    -webkit-margin-before: 0;
}

code, pre, #ws, #message {
    font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}


.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p>I really like the roadmap the core team has come up with. The only critic I personally would have is the need of the comma in <code>var op(lhs:,rhs:) : (Int, Int) -&gt; Int</code>. To me it would be consistent enough with selectors if there wasn’t any comma <code>var op(lhs:rhs:) : (Int, Int) -&gt; Int</code>.</p>

<p>I have a few questions about pitch #1.</p>

<ul>
<li><p>Assuming we’ll get that functionality, both <code>var</code> and <code>let</code> should satisfy the protocol requirements right?</p></li>
<li><p>Will this example be valid?</p></li>
</ul>

<pre><code class="swift">@objc protocol P : class {
    @objc optional func foo()
}

class A : NSObject, P {
    var foo: (() -&gt; Void)? = nil
}

A.init().foo?()
</code></pre>

<ul>
<li>If it is valid, could we potentially get optional functions in pure Swift as well?</li>
</ul>

<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1490646681681071872" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 26. März 2017 um 22:11:19, Xiaodi Wu via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>


<title></title>


I'm in favor of both of these.<br>
<br>
However, the issue outlined in (1) with respect to labels is
problematic. The core team's post-Swift 3 plan (<a href="https://lists.swift.org/pipermail/swift-evolution-announce/2016-July/000233.html">https://lists.swift.org/pipermail/swift-evolution-announce/2016-July/000233.html</a>)
for evolving from SE-0111 solves that problem without the need to
invent new rules for (1). IMO, that issue should be addressed
first, then (1).<br>
<div class="gmail_quote">
<div dir="ltr">On Sun, Mar 26, 2017 at 14:04 David Sweeris via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt;
wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg"></div>
<div class="gmail_msg">On Mar 26, 2017, at 11:12, Karl Wagner via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;
wrote:<br class="gmail_msg">
<br class="gmail_msg"></div>
<blockquote type="cite" class="gmail_msg">I’d like to pitch the
following two language changes. Both of them are technically
possible today if you manually write thunks for the relevant
protocol requirements, but it would be nice if we allowed them to
be written directly:
<div class="gmail_msg"><br class="gmail_msg"></div>
<div class="gmail_msg">1) Allow closures to satisfy function
requirements in protocols</div>
<div class="gmail_msg"><br class="gmail_msg"></div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class="gmail_msg">
<div class="gmail_msg">
<pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;color:rgb(36,41,46)" class="gmail_msg"><span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">protocol</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">MyProtocol</span> {
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">run</span>(<span class="m_-1316733808039533553pl-smi gmail_msg" style="box-sizing:border-box;color:rgb(51,51,51)">param</span>: <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>) <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">-&gt;</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>
}

<span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">struct</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">MyStruct</span> : <span class="m_-1316733808039533553pl-e gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">MyProtocol </span>{
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> run <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> (<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>)<span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">-&gt;</span><span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>   <span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box">//</span> Satisfies requirement MyProtocol.run</span>
}</pre>
<div class="gmail_msg"><br class="gmail_msg"></div>
</div>
</blockquote>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class="gmail_msg">Among other things, it would make writing
type-erased wrappers in the style of AnyCollection much easier. The
only obvious niggle is that the argument label wouldn’t be required
when invoking the closure directly. The labels have no type-system
significance, but it does make it subtly easier to write less
generic code than you intend do. We could solve this by having
code-completion favour protocol methods in this situation, or
simply to require the label when invoking a closure which
implements a known protocol requirement.</blockquote>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg"></div>
</blockquote>
2) Allow functions with default parameters to satisfy function
requirements in protocols
<div class="gmail_msg"><br class="gmail_msg"></div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class="gmail_msg">
<div class="gmail_msg">
<pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;color:rgb(36,41,46)" class="gmail_msg"><span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">protocol</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">Sportsplayer</span> {
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">goalsScored</span>() <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">-&gt;</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>
}

<span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">struct</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">SoccerPlayer</span>: <span class="m_-1316733808039533553pl-e gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">Sportsplayer </span>{
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">struct</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">GoalType</span> : <span class="m_-1316733808039533553pl-e gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">RawOptionSet </span>{
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> Shot   <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x1</span>)
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> Volley <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x10</span>)
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> Header <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x100</span>)
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Any</span>    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x111</span>)
    }

    <span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box">//</span> Default value .Any means this conforms to Sportsplayer</span>
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">goalsScored</span>(<span class="m_-1316733808039533553pl-smi gmail_msg" style="box-sizing:border-box;color:rgb(51,51,51)"><span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">type</span></span>: GoalType <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> .<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Any</span>) {
      <span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box">//</span>...</span>
    }
}

<span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">struct</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">Footballer</span>: <span class="m_-1316733808039533553pl-e gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">Sportsplayer </span>{
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">struct</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">GoalType</span> : <span class="m_-1316733808039533553pl-e gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">RawOptionSet </span>{
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> Touchdown <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x1</span>)
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> FieldGoal <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x10</span>)
        <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">static</span> <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Any</span>       <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">GoalType</span>(<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">0x11</span>)
    }

    <span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box">//</span> Default value .Any means this conforms to Sportsplayer</span>
    <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">goalsScored</span>(<span class="m_-1316733808039533553pl-smi gmail_msg" style="box-sizing:border-box;color:rgb(51,51,51)"><span class="m_-1316733808039533553pl-en gmail_msg" style="box-sizing:border-box;color:rgb(121,93,163)">type</span></span>: GoalType <span class="m_-1316733808039533553pl-k gmail_msg" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> .<span class="m_-1316733808039533553pl-c1 gmail_msg" style="box-sizing:border-box;color:rgb(0,134,179)">Any</span>) {
      <span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-1316733808039533553pl-c gmail_msg" style="box-sizing:border-box">//</span>...</span>
    }
}</pre>
<div class="gmail_msg"><br class="gmail_msg"></div>
</div>
<div class="gmail_msg">I often find that I want to add some
optional, implementation-specific parameter to a function which
implements a protocol requirement. That’s currently not possible,
and it’s a bit annoying.</div>
</blockquote>
</blockquote>
<br class="gmail_msg"></div>
<div dir="auto" class="gmail_msg">
<div class="gmail_msg">IIRC, the issue with #2 is that protocols
specify declaration-site details, but default parameters are
implemented at the call-site. At least I believe that statement was
accurate about a year(ish) ago... Dunno if anything has changed
since then.</div>
<div class="gmail_msg"><br class="gmail_msg"></div>
<div class="gmail_msg">If it can be made to work, though, I'd be in
favor of it, and I think #1 as well.</div>
<div class="gmail_msg"><br class="gmail_msg"></div>
<div class="gmail_msg">- Dave Sweeris</div>
</div>
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote>
</div>


_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>