<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>“Out of scope for Swift 4” means that there is no time for it now and the community should focus on features and issues yet to be solved in Swift 4. In other words it means that you should defer the proposal at least until Swift 4 is released.</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_1493063891800988928" 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 24. April 2017 um 21:57:13, Joshua Alvarado 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>


<div dir="ltr">When would be a good time to resubmit this proposal
for discussion? Or can I still proceed with the review and it
possibly&nbsp;gets deferred but at least be&nbsp;put in the
pipeline (if deferred)?</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Apr 24, 2017 at 9:07 AM, Douglas
Gregor <span dir="ltr">&lt;<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br>
<div>
<blockquote type="cite">
<div><span class="">On Apr 24, 2017, at 7:23 AM, T.J. Usiyan via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;
wrote:</span></div>
<span class=""><br class="m_-8866656930036938234Apple-interchange-newline"></span>
<div>
<div dir="ltr"><span class="">/me Pushes implementation detail
related concerns out of head</span>
<div><span class=""><br></span></div>
<div><span class="">+1</span></div>
<div><span class=""><br></span></div>
<div><span class=""><br></span></div>
<div><span class="">I want this feature but I seriously doubt that
it is feasible at the moment. There are so many 'more pressing'
features that, even if this were accepted now, it wouldn't be
implemented it in time for Swift 4.</span></div>
</div>
</div>
</blockquote>
<div><span class=""><br></span></div>
<div>Out of scope for Swift 4, certainly. It may not look like it,
but this is a fairly large feature. I suggest reading up
on&nbsp;<a href="https://en.wikipedia.org/wiki/Generalized_algebraic_data_type" target="_blank">generalized algebraic data types</a>&nbsp;(GADTs),
which is the more programming-language-<wbr>theoretical name for
what you’re describing here.</div>
<div><br></div>
- Doug</div>
<div>
<div class="h5">
<div><br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div><br></div>
<div>That said, I would love to be incorrect.&nbsp;</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Apr 24, 2017 at 9:57 AM, Joshua
Alvarado via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<h1 style="box-sizing:border-box;margin:0px 0px 16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46)">
<font face="arial, helvetica, sans-serif" size="2"><span style="font-weight:normal">Here is my pitch on adding generics to enum
cases and not to the enum type itself. Let me know if you have an
improvements or modifications lets open it to discussion thank you
swiftys! :)</span></font></h1>
<h1 style="box-sizing:border-box;margin:0px 0px 16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
Enum with generic cases</h1>
<ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
<li style="box-sizing:border-box">Proposal:&nbsp;<a href="https://github.com/lostatseajoshua/swift-evolution/blob/master/NNNN-enum-generic-cases.md" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">SE-NNNN</a></li>
<li style="box-sizing:border-box;margin-top:0.25em">
Authors:&nbsp;<a href="https://github.com/alvaradojoshua0" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">Joshua Alvarado</a></li>
<li style="box-sizing:border-box;margin-top:0.25em">Review Manager:
TBD</li>
<li style="box-sizing:border-box;margin-top:0.25em">
Status:&nbsp;<span style="box-sizing:border-box;font-weight:600">PITCH</span></li>
</ul>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
<em style="box-sizing:border-box">During the review process, add
the following fields as needed:</em></p>
<ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
<li style="box-sizing:border-box">Decision Notes:&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">Rationale</a>,&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">Additional Commentary</a></li>
<li style="box-sizing:border-box;margin-top:0.25em">
Bugs:&nbsp;<a href="https://bugs.swift.org/browse/SR-NNNN" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">SR-NNNN</a>,&nbsp;<a href="https://bugs.swift.org/browse/SR-MMMM" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">SR-MMMM</a></li>
<li style="box-sizing:border-box;margin-top:0.25em">Previous
Revision:&nbsp;<a href="https://github.com/apple/swift-evolution/blob/...commit-ID.../proposals/NNNN-filename.md" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">1</a></li>
<li style="box-sizing:border-box;margin-top:0.25em">Previous
Proposal:&nbsp;<a href="https://github.com/lostatseajoshua/swift-evolution/blob/master/XXXX-filename.md" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">SE-XXXX</a></li>
</ul>
<h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
<a id="m_-8866656930036938234m_-2418809334444009596gmail-user-content-introduction" class="m_-8866656930036938234m_-2418809334444009596gmail-anchor" href="https://github.com/lostatseajoshua/swift-evolution/tree/master#introduction" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Introduction</h2>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
This proposal adds a change to the enumeration type that allows an
enum case to cast a generic on its associated value.</p>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
Swift-evolution thread:&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank">Discussion thread topic for that proposal</a></p>
<h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
<a id="m_-8866656930036938234m_-2418809334444009596gmail-user-content-motivation" class="m_-8866656930036938234m_-2418809334444009596gmail-anchor" href="https://github.com/lostatseajoshua/swift-evolution/tree/master#motivation" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Motivation</h2>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
Enums currently support generics, but they are added onto the type
itself. This can cause adverse syntax when implementing generics
for associated values to be stored along each case. The enum case
holds the associated value (not the enum type itself) so should
create its own value constraints.</p>
<h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
<a id="m_-8866656930036938234m_-2418809334444009596gmail-user-content-proposed-solution" class="m_-8866656930036938234m_-2418809334444009596gmail-anchor" href="https://github.com/lostatseajoshua/swift-evolution/tree/master#proposed-solution" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Proposed solution</h2>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
The generic is to be casted on the case of the enum and not on the
enum itself.</p>
<h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
<a id="m_-8866656930036938234m_-2418809334444009596gmail-user-content-detailed-design" class="m_-8866656930036938234m_-2418809334444009596gmail-anchor" href="https://github.com/lostatseajoshua/swift-evolution/tree/master#detailed-design" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Detailed design</h2>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
Current implementation:</p>
<div class="m_-8866656930036938234m_-2418809334444009596gmail-highlight-source-swift m_-8866656930036938234m_-2418809334444009596gmail-highlight" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
<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"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> enum with two generic types</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Foo</span>&lt;<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">T</span>: <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-e" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span></span>, <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">U</span>: <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-e" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Collection</span></span>&gt; {
    <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">obj</span></span>: T)
    <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">baz</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">obj</span></span>: U)
}

<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> U is to be casted but it is not even used</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> foo<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> Foo<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&lt;</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>, [<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>]<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&gt;</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> .<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">obj</span>: <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-s" style="box-sizing:border-box;color:rgb(24,54,145)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span>hash<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span></span>)

<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> Creating an optional enum, the generics have to be casted without a value set</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> The casting is really not needed as the values should be casted not the enum</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> foo1<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> Foo<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&lt;</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>, [<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>]<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&gt;?</span>

<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> Collections don’t look great either</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> foos <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> [Foo<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&lt;</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>, [<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>]<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&gt;</span>]()
foos.<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">append</span>(.<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">obj</span>:<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-s" style="box-sizing:border-box;color:rgb(24,54,145)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span>hash<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span></span>))</pre></div>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
Proposed solution</p>
<div class="m_-8866656930036938234m_-2418809334444009596gmail-highlight-source-swift m_-8866656930036938234m_-2418809334444009596gmail-highlight" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
<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"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Foo</span> {
    <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&lt;</span>T<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&gt;</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">obj</span>: T)
    <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">baz</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&lt;</span>U<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Collection</span><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">&gt;</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">obj</span>: U)
}

<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> generic type inferred on T</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> foo<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> Foo <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> .<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">obj</span>: <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-s" style="box-sizing:border-box;color:rgb(24,54,145)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span>hash<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span></span>)  

<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> doesn’t need to cast the generic on the optional enum</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> the associated value will hold the cast</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> foo1<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> Foo<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">?</span>  

<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c" style="box-sizing:border-box">//</span> This also gives better syntax with collections of enums with associated types</span>
<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> foos <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> [Foo]()
foos.<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">append</span>(.<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">obj</span>: <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-s" style="box-sizing:border-box;color:rgb(24,54,145)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span>hey<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-pds" style="box-sizing:border-box">"</span></span>)</pre></div>
<h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
<a id="m_-8866656930036938234m_-2418809334444009596gmail-user-content-source-compatibility" class="m_-8866656930036938234m_-2418809334444009596gmail-anchor" href="https://github.com/lostatseajoshua/swift-evolution/tree/master#source-compatibility" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Source compatibility</h2>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
This may cause subtle breaking changes for areas in code with
generic enum cases. The compiler could help with the change by
finding the associated generic and updating the case with the new
syntax.</p>
<h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol'">
<a id="m_-8866656930036938234m_-2418809334444009596gmail-user-content-alternatives-considered" class="m_-8866656930036938234m_-2418809334444009596gmail-anchor" href="https://github.com/lostatseajoshua/swift-evolution/tree/master#alternatives-considered" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Alternatives considered</h2>
<p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
An alternative would be to extend the&nbsp;<code style="box-sizing:border-box;font-family:sfmono-regular,consolas,'liberation mono',menlo,courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">associatedtype</code>&nbsp;keyword
to the enum type.</p>
<div class="m_-8866656930036938234m_-2418809334444009596gmail-highlight-source-swift m_-8866656930036938234m_-2418809334444009596gmail-highlight" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,'segoe ui',helvetica,arial,sans-serif,'apple color emoji','segoe ui emoji','segoe ui symbol';font-size:16px">
<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"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Foo</span> {
    <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">associatedtype</span> T <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Hashable</span>
    <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">bar</span>(<span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="m_-8866656930036938234m_-2418809334444009596gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">obj</span></span>: T)
}</pre></div>
</div>
<div><br></div>
Copy of proposal can be found here&nbsp;<a href="https://github.com/lostatseajoshua/swift-evolution/blob/master/NNNN-enum-generic-cases.md" target="_blank">Swift proposal on github</a>
<div>
<div><span class="m_-8866656930036938234HOEnZb"><font color="#888888"><br></font></span></div>
<span class="m_-8866656930036938234HOEnZb"><font color="#888888">--<br></font></span>
<div class="m_-8866656930036938234m_-2418809334444009596gmail_signature">
<span class="m_-8866656930036938234HOEnZb"><font color="#888888">Joshua Alvarado</font></span>
<div><span class="m_-8866656930036938234HOEnZb"><font color="#888888"><a href="mailto:alvaradojoshua0@gmail.com" target="_blank">alvaradojoshua0@gmail.com</a></font></span></div>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-evolution</a><br>

<br></blockquote>
</div>
<br></div>
______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</div>
</blockquote>
</div>
<br></div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br></div>
--<br>
<div class="gmail_signature" data-smartmail="gmail_signature">
Joshua Alvarado
<div><a href="mailto:alvaradojoshua0@gmail.com" target="_blank">alvaradojoshua0@gmail.com</a></div>
</div>
</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>