<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I'm biased as the pitcher, but I find that an "inheritance" model would be more straightforward than an inclusive model.<div class=""><br class=""></div><div class="">If I understand you correctly, with this model:</div><div class=""><br class=""></div><div class=""></div><blockquote type="cite" class=""><div class="">enum NetworkException {<br class="">&nbsp; case NoInternetError, SecurityError<br class="">}</div><div class=""><br class=""></div><div class=""><span style="font-family: LucidaGrande;" class="">enum ChangePictureError {</span><br class="" style="font-family: LucidaGrande;"><span style="font-family: LucidaGrande;" class="">&nbsp; case NetworkException(NetworkException)</span><br class="" style="font-family: LucidaGrande;"><span style="font-family: LucidaGrande;" class="">&nbsp; case ParseException(ParseException)</span><br class="" style="font-family: LucidaGrande;"><span style="font-family: LucidaGrande;" class="">&nbsp; case PictureTooLarge</span><br class="" style="font-family: LucidaGrande;"><span style="font-family: LucidaGrande;" class="">}</span><br class=""></div></blockquote><div class=""><br class=""></div>you're saying that we should be able to write:<div class=""><br class=""></div><div class=""><blockquote type="cite" class="">let x: ChangePictureError = NetworkException.NoInternetError<br class=""></blockquote><div class=""><div class=""><br class=""></div><div class="">The implicit conversion from NetworkException to ChangePictureError reminds me of C++ implicit constructors, which are generally frowned upon, so I'm not sure that this is the best way forward.</div><div class=""><br class=""></div><div class="">On the other hand, going back to my original example:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">enum MyLibError: ErrorType {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case FileNotFound<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case UnexpectedEOF<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case PermissionDenied<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>// ... 300 cases later<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case FluxCapacitorFailure<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case SplineReticulationError<br class="">}<br class=""><br class="">enum FileSystemError: MyLibError {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case FileNotFound = .FileNotFound<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case UnexpectedEOF = .UnexpectedEOF<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case PermissionDenied = .PermissionDenied<br class="">}</blockquote></div><div class=""><br class=""></div><div class="">I can easily rationalize that FileSystemError is implicitly convertible to MyLibError because of the "inheritance" relationship.</div><div class=""><br class=""></div><div class="">Félix<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 19 déc. 2015 à 14:28:44, Matthew Johnson &lt;<a href="mailto:matthew@anandabits.com" class="">matthew@anandabits.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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 class=""><br class="Apple-interchange-newline">On Dec 18, 2015, at 11:34 AM, Dennis Lysenko 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 dir="ltr" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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 class="">Sorry, I got a bit too excited and skimmed over the most important part of the idea. So this is a special type of enum declaration in which you cannot declare any new enum members. I personally have not seen a use for this in my code but I would love to hear others' response to it.&nbsp;<span class="" style="line-height: 1.5;">It is a very interesting idea though.</span></div><div class=""><span class="" style="line-height: 1.5;"><br class=""></span></div><div class=""><span class="" style="line-height: 1.5;">I'm going to go out on a limb with an idea that is in the same vein as this one: What if we favored composition over inheritance here, and made it so that you could transparently refer to members of other enums *without* having another enum as a backing type?</span><br class=""></div><div class=""><br class=""></div><div class="">e.g., you have:</div><div class="">enum NetworkException {</div><div class="">&nbsp; case NoInternetError, SecurityError</div><div class="">}</div><div class=""><br class=""></div><div class="">enum ParseException {</div><div class="">&nbsp; case FailedResponse(statusCode: Int)</div><div class="">&nbsp; case EmptyResponse</div><div class="">&nbsp; case MissingField(fieldName: String)</div><div class="">}</div><div class=""><br class=""></div><div class="">As two general classes of errors. But for a full API call wrapper, you might want an error class that composes the two, so that when calling the API call from your UI code, you can display a "please check your connection" message for NoInternetError, a "Please log in" error for FailedResponse with statusCode=401, or a "server error" message for any of the rest.&nbsp;</div><div class=""><br class=""></div><div class="">I wonder how do you and others feel about that use-case? I have certainly seen it come up a lot in real-world projects that require resilient UI interactions with nontrivial networking operations.</div><div class=""><br class=""></div><div class="">Here are some quick code samples off the top of my head for how we might go about this (let's say the API operation is "change profile picture":</div><div class=""><br class=""></div><div class="">enum ChangePictureError {</div><div class="">&nbsp; include NetworkException</div><div class="">&nbsp; include ParseException</div><div class="">&nbsp; case PictureTooLarge</div><div class="">}</div></div></div></blockquote><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">By including all of the cases you make it possible for ChangePictureError to be a supertype of NetworkException and ParseException. &nbsp;This is a pretty interesting idea. &nbsp;It might be worth exploring. &nbsp;</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">One thing that would need to be considered is that ideally if the actual values was a NetworkException case you would want to be able to call any methods exposed by Network Exception. &nbsp;A good way to accomplish that might be to add implicit conversion as well as syntactic sugar for nested enums. &nbsp;So if we have this:</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">enum ChangePictureError {<br class="">&nbsp; case NetworkException(NetworkException)<br class="">&nbsp; case ParseException(ParseException)<br class="">&nbsp; case PictureTooLarge<br class="">}</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">I can do this:</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">var error: ChangePictureError // set somewhere, can be set with a NetworkException or a PictureTooLarge</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">switch error {</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">case .NoNetworkError: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;// equivaluent to case .NetworkException(.NoNetworkError)</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">case .NoInternetError: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// equivaluent to case .NetworkException(.&nbsp;NoInternetError)</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">case .FailedResponse(let statusCode): // equivaluent to case .ParseException(.FailedResponse(let statusCode))</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">case .EmptyResponse: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// equivaluent to case .ParseException(.EmptyResponse)</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">case .MissingField(let fieldName): &nbsp; &nbsp; &nbsp; &nbsp; // equivaluent to case .ParseException(.&nbsp;MissingField(let fieldName))</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">case .PictureTooLarge:</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">The syntactic sugar would only work for case names where there is no overlap. &nbsp;Case names that overlap would need to be explicitly disambiguated. &nbsp;The syntactic sugar and implicit conversions could allow for either single-level nesting or arbitrary nesting depth. &nbsp;An example of arbitrary depth might be ParseException also containing a ValidationError case:</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">enum ValidationError {</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">&nbsp; case OutOfRange</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">&nbsp; case InvalidType</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">enum ParseException {</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">&nbsp; case ValidationError(ValidationError)<br class="">&nbsp; case FailedResponse(statusCode: Int)<br class="">&nbsp; case EmptyResponse<br class="">&nbsp; case MissingField(fieldName: String)<br class=""><div dir="ltr" class=""><div class="">}</div></div></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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="">Mostly just thinking out loud here and exploring the idea. &nbsp;What do others think of this?</div><br class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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;"><blockquote type="cite" class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: 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 class=""><div dir="ltr" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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 class=""><br class=""></div><div class="">or</div><div class=""><br class=""></div><div class="">enum ChangePictureError {</div><div class="">&nbsp; compose NetworkException.NoInternetError</div><div class="">&nbsp; compose ParseException.EmptyResponse</div><div class="">&nbsp; compose ParseException.FailedResponse(statusCode: Int)</div><div class="">&nbsp; case PictureTooLarge</div><div class="">}</div><div class=""><br class=""></div><div class="">Not a proposal by any stretch of the imagination, just a potential direction inspired by your idea, Felix.</div><div class=""><br class=""></div></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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 class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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 dir="ltr" class="">On Fri, Dec 18, 2015 at 12:21 PM Dennis Lysenko &lt;<a href="mailto:dennis.s.lysenko@gmail.com" class="">dennis.s.lysenko@gmail.com</a>&gt; wrote:<br class=""></div><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 dir="ltr" class="">Felix,&nbsp;<div class=""><br class=""></div><div class="">This seems to be very interestingly tied into your comments about polymorphism in 'throws' type annotations. Would you not feel that allowing enums to be built on top of other enums would promote the kind of egregious proliferation of exception polymorphism that discourages so many from following Java's checked exception model?&nbsp;</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Dec 18, 2015 at 11:29 AM Félix Cloutier &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><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;">Hi all,<br class=""><br class="">Swift currently has more or less three conceptual types of enums: discriminated unions, lists of unique tokens, and lists of value of a raw type.<br class=""><br class="">&gt; // Discriminated unions<br class="">&gt; enum Foo {<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case Bar(Int)<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case Baz(String)<br class="">&gt; }<br class="">&gt;<br class="">&gt; // Lists of unique tokens (mixable with discriminated unions)<br class="">&gt; enum Foo {<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case Frob<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case Nicate<br class="">&gt; }<br class="">&gt;<br class="">&gt; // Lists of raw values<br class="">&gt; enum Foo: String {<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case Bar = "Bar"<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case Baz = "Baz"<br class="">&gt; }<br class=""><br class="">I think that the last case could be made more interesting if you could use more types as underlying types. For instance, it could probably be extended to support another enum as the backing type. One possible use case would be to have a big fat enum for all the possible errors that your program/library can throw, but refine that list into a shorter enum for functions that don't need it all.<br class=""><br class="">&gt; enum MyLibError: ErrorType {<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case FileNotFound<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case UnexpectedEOF<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case PermissionDenied<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;// ... 300 cases later<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case FluxCapacitorFailure<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case SplineReticulationError<br class="">&gt; }<br class="">&gt;<br class="">&gt; enum FileSystemError: MyLibError {<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case FileNotFound = .FileNotFound<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case UnexpectedEOF = .UnexpectedEOF<br class="">&gt;&nbsp; &nbsp; &nbsp; &nbsp;case PermissionDenied = .PermissionDenied<br class="">&gt; }<br class=""><br class="">This example could be made simpler if the `= .Foo` part was inferred from the name, but you get the idea.<br class=""><br class="">In this case, it would be helpful (but not required) that FileSystemError was convertible into a MyLibError, so that it could be transparently rethrown in a function that uses the larger enum. I personally don't see why enums with a specified underlying type can't be implicitly converted to it, but this is not currently the case and it probably deserves some discussion as well.<br class=""><br class="">Is there any interest in that?<br class=""><br class="">Félix<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote></div></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAe2BJg05It4YmJpYYhgeIun5oPlQyNvL7cz7Ifkc1ps77nyaEQghVfFbD5rF9yE6zh-2FbshhFf7qCpnVtCAyPTatimrftT-2F-2Fi-2BfGFlAZY4xseLkrncBxqtQxBL5LYVkzivj4hUQ8LoGK3f-2F6NT0H-2F9kNZh0yDG-2Fq2VomQ5Pu2L-2FS9Kl3p2-2FA4iFQ7rinRdq-2FG34-3D" alt="" width="1" height="1" border="0" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">swift-evolution mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><a href="mailto:swift-evolution@swift.org" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">swift-evolution@swift.org</a><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></blockquote></div><br class=""></div></div></div></div></body></html>