<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’ll read closely all the feedback we’ve got here so far and comment when I’m done with my work today.</p>

<p>Here is the <em>future direction</em> part from the other proposal we haven’t submitted yet, where I believe Joe mentioned a few words in that direction:</p>

<h2 id="futuredirections">Future directions</h2>

<ul>
<li><p><code>any&lt;...&gt;</code> should reflect powerful generalized generic features to be able to constrain types even further (e.g. <code>where</code> clause).</p></li>
<li><p>Adding constraints for other extendable types like <code>struct</code> and <code>enum</code> and generalize these. This will allow us to form more typealiases like:</p>

<pre><code class="swift">typealias AnyStruct = any&lt;struct&gt;
typealias AnyEnum = any&lt;enum&gt;
</code></pre>

<ul>
<li>Example:</li>
</ul>

<pre><code class="swift">protocol A { func boo() }

// Structs that conforms to a specific protocol.
func foo(value: any&lt;struct, SomeProtocol&gt;)  
func foo(value: any&lt;AnyStruct, SomeProtocol&gt;)  
     
// Enums that conforms to a specific protocol.
func foo(value: any&lt;enum, SomeProtocol&gt;)  
func foo(value: any&lt;AnyEnum, SomeProtocol&gt;)  
     
// Lets say this array is filled with structs, classes and enums,
// which all conforms to `SomeProtocol`.
let array: [SomeProtocol] = // fill

// Filter these types:
var classArray: [any&lt;class, SomeProtocol&gt;] = array.flatMap { $0 as? any&lt;class, SomeProtocol&gt; }
var structArray: [any&lt;struct, SomeProtocol&gt;] = array.flatMap { $0 as? any&lt;struct, SomeProtocol&gt; }
var enumArray: [any&lt;enum, SomeProtocol&gt;] = array.flatMap { $0 as? any&lt;enum, SomeProtocol&gt; }
</code></pre></li>
</ul>

<p>Flattened operators or even <code>Type operators</code> for <code>any&lt;...&gt;</code>:</p>

<pre><code class="swift">class B {
    var mainView: UIView &amp; SomeProtocol
     
    init(view: UIView &amp; SomeProtocol) {
        self. mainView = view
    }
}
</code></pre>

<blockquote>
<p>The <code>&amp;</code> type operator would produce a “flattened" <code>any&lt;&gt;</code> with its operands. It could be overloaded to accept either a concrete type or a protocol on the lhs and would produce <code>Type</code> for an lhs that is a type and <code>any&lt;...&gt;</code> when lhs is a protocol. <code>Type operators</code> would be evaluated during compile time and would produce a type that is used where the expression was present in the code. This is a long-term idea, not something that needs to be considered right now. </p>

<p>Written by: <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160509/017499.html">Matthew Johnson</a></p>
</blockquote>

<p>Adding <code>one&lt;...&gt;</code> which can reduce overloading (idea provided by: <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160509/017397.html">Thorsten Seitz</a>). <code>one&lt;...&gt;</code> will pick the first type match from within the angle brackets to the dynamic type at compile time and proceed. One would then need to handle the value by own desire.</p>

<pre><code class="swift">func foo(value: one&lt;String, Int&gt;) {
     
    if let v = value as? String {
        // Do some work
    } else if let v = value as? Int {
        // Do some work
    }
}
     
// Flattened version:
func foo(value: String | Int)
</code></pre>

<p>Mix <code>any&lt;...&gt;</code> and <code>one&lt;...&gt;</code>:</p>

<pre><code class="swift">// Accept only types constrained by  
// (`ClassA` AND `SomeProtocol`) OR (`ClassB` AND `SomeProtocol`)
func foo(value: any&lt;one&lt;ClassA, ClassB&gt;, SomeProtocol&gt;)

// Flattened version:
func foo(value: (ClassA | ClassB) &amp; SomeProtocol)
</code></pre>

<p>Typealias <code>AnyValue</code> (for extendable types only):</p>

<pre><code class="swift">// Isn't this like magic
typealias AnyValue = one&lt;any&lt;struct&gt;, any&lt;enum&gt;&gt;  
typealias AnyValue = one&lt;AnyStruct, AnyEnum&gt;
typealias AnyValue = any&lt;struct&gt; | any&lt;enum&gt;
typealias AnyValue = AnyStruct | AnyEnum

// Any value which conforms to `SomeProtocol`.
// Reference types are finally out the way.
func foo(value: any&lt;AnyValue, SomeProtocol&gt;)  

// Flattened version:
func foo(value: AnyValue &amp; SomeProtocol)
</code></pre>

<p>————</p>

<p><code>one&lt;…&gt;</code> is a different story, so don’t stick with it too much in this discussion.</p>

<p>@Austin: If you’re going to update the future direction of this proposal you may want to use something from the <em>future direction</em> part I just posted.</p>

<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_1464161460561202944" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Adrian Zubarev<br>Sent with Airmail</div></div></div><div class="bloop_markdown"><p></p></div></body></html>