<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>Sorry, I couldn’t follow every thread. I simply couldn’t get that fact from the given context of the first post by Anton. :) Just forget everything I mentioned about typealias, because it was based on the assumption of an error list.</p>

<p>Anyways +1 for typed throws. The syntax <code>throws(T)</code> and <code>rethrows(T)</code> is fine by me.</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_1487360769079386880" 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 17. Februar 2017 um 20:45:55, Matthew Johnson (<a href="mailto:matthew@anandabits.com">matthew@anandabits.com</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div></div><div>



<title></title>


<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Feb 17, 2017, at 1:42 PM, Adrian Zubarev via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px;" class="">So the typed throws are going to be limited to a single
error type, is that the direction we're heading to?</div>
</div>
</blockquote>
<div><br class=""></div>
Yes, this topic was discussed thoroughly last year.</div>
<div><br class="">
<blockquote type="cite" class="">
<div class=""><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<div id="bloop_sign_1487360439950413824" class="bloop_sign" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div style="font-family: helvetica, arial; font-size: 13px;" class="">--&nbsp;<br class="">
Adrian Zubarev<br class="">
Sent with Airmail</div>
</div>
<br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<p class="airmail_on" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Am 17. Februar 2017 um 20:39:12, Anton Zhilin (<a href="mailto:antonyzhilin@gmail.com" class="">antonyzhilin@gmail.com</a>) schrieb:</p>
<blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">
<div class="">
<div class=""></div>
<div class="">
<div dir="ltr" class="">
<div class="markdown-here-wrapper">
<p style="margin: 0px 0px 1.2em !important;" class=""><span class="">In this case, you’d better create a new error type, which
includes all the cases of those errors:</span></p>
<pre style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;" class=""><span class=""><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; background-color: rgb(248, 248, 248); white-space: pre; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em 0.7em; display: block !important;" class="">// FileNotFoundError and WrongFormat are Error-s

struct PreferencesError : Error {
    init(_: FileNotFoundError)
    init(_: WrongFormat)
    // ...
}

func readPreferences() throws(PreferencesError)
</code></span></pre>
<p style="margin: 0px 0px 1.2em !important;" class=""><span class="">In the most “lazy” case, you’d just create an enum of those
two:</span></p>
<pre style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;" class=""><span class=""><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; background-color: rgb(248, 248, 248); white-space: pre; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em 0.7em; display: block !important;" class="">enum PreferencesError : Error {
    case fileNotFound(FileNotFoundError)
    case wrongFormat(WrongFormatError)
}
</code></span></pre>
<p style="margin: 0px 0px 1.2em !important;" class=""><span class="">Better yet, you should analyze, which cases are meaningful for
user of<span class="Apple-converted-space">&nbsp;</span><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;" class="">readPreferences</code>, and present them with appropriate
interface. You may want to crash on those cases of initial error
types, with which you can’t do anything on the level of abstraction
of<span class="Apple-converted-space">&nbsp;</span><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;" class="">readPreferences</code>. Some of the others will be merged
or renamed.</span></p>
<p style="margin: 0px 0px 1.2em !important;" class="">With proper
error types, a single type in<span class="Apple-converted-space">&nbsp;</span><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;" class="">throws</code><span class="Apple-converted-space">&nbsp;</span>clause is enough, without sum
types.</p>
<p style="margin: 0px 0px 1.2em !important;" class="">2017-02-17
22:22 GMT+03:00 Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;:</p>
<div style="margin: 0px 0px 1.2em !important;" class=""><br class="webkit-block-placeholder"></div>
<div class="markdown-here-exclude">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">
<div style="word-wrap: break-word;" class="">
<div class="m_7383326189739117365bloop_markdown">
<p class="">Sure thing, but that’s not what I was asking about.
Kevin made a protocol that conforms to<span class="Apple-converted-space">&nbsp;</span><code class="">Error</code><span class="Apple-converted-space">&nbsp;</span>where all the his enums
conformed to<span class="Apple-converted-space">&nbsp;</span><code class="">MyError</code><span class="Apple-converted-space">&nbsp;</span>protocol. That way we’re
losing all enum cases and are not really a step further as
before.</p>
</div>
</div>
</blockquote>
</div>
<div style="margin: 0px 0px 1.2em !important;" class=""><br class="webkit-block-placeholder"></div>
<div title="MDH:SW4gdGhpcyBjYXNlLCB5b3UnZCBiZXR0ZXIgY3JlYXRlIGEgbmV3IGVycm9yIHR5cGUsIHdoaWNo IGluY2x1ZGVzIGFsbCB0aGUgY2FzZXMgb2YgdGhvc2UgZXJyb3JzOjxkaXY+PGJyPjwvZGl2Pjxk aXY+YGBgPC9kaXY+PGRpdj4vLyBGaWxlTm90Rm91bmRFcnJvciBhbmQgV3JvbmdGb3JtYXQgYXJl IEVycm9yLXM8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PnN0cnVjdCBQcmVmZXJlbmNlc0Vycm9y IDogRXJyb3IgezwvZGl2PjxkaXY+Jm5ic3A7ICZuYnNwOyBpbml0KF86IEZpbGVOb3RGb3VuZEVy cm9yKTwvZGl2PjxkaXY+Jm5ic3A7ICZuYnNwOyBpbml0KF86IFdyb25nRm9ybWF0KTwvZGl2Pjxk aXY+Jm5ic3A7ICZuYnNwOyAvLyAuLi48L2Rpdj48ZGl2Pn08L2Rpdj48ZGl2Pjxicj48L2Rpdj48 ZGl2PmZ1bmMgcmVhZFByZWZlcmVuY2VzKCkgdGhyb3dzKFByZWZlcmVuY2VzRXJyb3IpPC9kaXY+ PGRpdj5gYGA8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PkluIHRoZSBtb3N0ICJsYXp5IiBjYXNl LCB5b3UnZCBqdXN0IGNyZWF0ZSBhbiBlbnVtIG9mIHRob3NlIHR3bzo8L2Rpdj48ZGl2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hIHN3aWZ0LWV2b2x1dGlvbiA8c3BhbiBk aXI9Imx0ciI+Jmx0OzxhIGhyZWY9Im1haWx0bzpzd2lmdC1ldm9sdXRpb25Ac3dpZnQub3JnIiB0 YXJnZXQ9Il9ibGFuayI+c3dpZnQtZXZvbHV0aW9uQHN3aWZ0Lm9yZzwvYT4mZ3Q7PC9zcGFuPjo8 YnI+PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0ibWFyZ2luOjAgMCAwIC44 ZXg7Ym9yZGVyLWxlZnQ6MXB4ICNjY2Mgc29saWQ7cGFkZGluZy1sZWZ0OjFleCI+PGRpdiBzdHls ZT0id29yZC13cmFwOmJyZWFrLXdvcmQiPjxkaXYgY2xhc3M9Im1fNzM4MzMyNjE4OTczOTExNzM2 NWJsb29wX21hcmtkb3duIj48cD5TdXJlIHRoaW5nLCBidXQgdGhhdOKAmXMgbm90IHdoYXQgSSB3 YXMgYXNraW5nIGFib3V0LiBLZXZpbiBtYWRlIGEgcHJvdG9jb2wgdGhhdCBjb25mb3JtcyB0byA8 Y29kZT5FcnJvcjwvY29kZT4gd2hlcmUgYWxsIHRoZSBoaXMgZW51bXMgY29uZm9ybWVkIHRvIDxj b2RlPk15RXJyb3I8L2NvZGU+IHByb3RvY29sLiBUaGF0IHdheSB3ZeKAmXJlIGxvc2luZyBhbGwg ZW51bSBjYXNlcyBhbmQgYXJlIG5vdCByZWFsbHkgYSBzdGVwIGZ1cnRoZXIgYXMgYmVmb3JlLjwv cD48L2Rpdj48L2Rpdj48L2Jsb2NrcXVvdGU+PC9kaXY+PGJyPjwvZGl2PjwvZGl2Pg==" style="height: 0px; width: 0px; max-height: 0px; max-width: 0px; overflow: hidden; font-size: 0em; padding: 0px; margin: 0px;" class=""></div>
</div>
</div>
</div>
</div>
</blockquote>
<span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div>
</blockquote>
</div>
<br class="">


</div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>