<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 think what you want here (pretty desirable in many situations) is more like a "guard catch" alternative to the usual "guard else" :)<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 7 Dec 2015, at 15:24, Liam Butler-Lawrence via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; 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="">I completely agree Wei. Using <i class="">try</i> as a keyword placed before every <i class="">throw</i>ing function is one of the greatest strengths of Swift’s error-handling model.</div><div class=""><br class=""></div><div class="">I do have a new proposal regarding do/try/catch (if I should post this in a new thread, please let me know):</div><div class=""><br class=""></div><div class="">————</div><div class=""><br class=""></div><div class=""><b class="">The problem:</b></div><div class=""><br class=""></div><div class="">In Swift 1.0, the only way to conditionally unwrap an optional was with <i class="">if let. </i>This ended up causing the “pyramid of doom” so often that in Swift 2.0, <i class="">guard let</i> was introduced.</div><div class=""><br class=""></div><div class="">The same problem is present with do/try/catch. Consider this code snippet:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span> coordinator = <span class="" style="color: rgb(112, 61, 170);">NSPersistentStoreCoordinator</span>(managedObjectModel: <span class="" style="color: rgb(79, 129, 135);">managedObjectModel</span>)</div></div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">do</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">let</span> documentsDirectoryURL = <span class="" style="color: rgb(187, 44, 162);">try</span> <span class="" style="color: rgb(112, 61, 170);">NSFileManager</span>.<span class="" style="color: rgb(61, 29, 129);">defaultManager</span>().<span class="" style="color: rgb(61, 29, 129);">URLForDirectory</span>(.<span class="" style="color: rgb(61, 29, 129);">DocumentDirectory</span>, inDomain: .UserDomainMask, appropriateForURL: <span class="" style="color: rgb(187, 44, 162);">nil</span>, create: <span class="" style="color: rgb(187, 44, 162);">false</span>)</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">let</span> persistentStoreFileName = <span class="" style="color: rgb(209, 47, 27);">"CoreDataStore.sqlite"</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">let</span> persistentStoreURL = documentsDirectoryURL.<span class="" style="color: rgb(61, 29, 129);">URLByAppendingPathComponent</span>(persistentStoreFileName)</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">do</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">try</span> <span class="" style="color: rgb(79, 129, 135);">coordinator</span>.<span class="" style="color: rgb(61, 29, 129);">addPersistentStoreWithType</span>(<span class="" style="color: rgb(112, 61, 170);">NSSQLiteStoreType</span>, configuration: <span class="" style="color: rgb(187, 44, 162);">nil</span>, URL: persistentStoreURL, options: <span class="" style="color: rgb(187, 44, 162);">nil</span>)</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> AnotherError.Case1 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> AnotherError.Case2 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> AnotherError.Case3 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">catch</span> <span class="" style="color: rgb(79, 129, 135);">MyError</span>.Case1 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">catch</span> <span class="" style="color: rgb(79, 129, 135);">MyError</span>.Case2 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">catch</span> <span class="" style="color: rgb(79, 129, 135);">MyError</span>.Case3 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);">catch<span class="" style=""> {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div></div><div class=""><br class=""></div><div class="">First, yes, I know that URLForDirectory() doesn’t throw MyError. I’m illustrating the common pattern using actual function calls.</div><div class=""><br class=""></div><div class="">I see two problems with the above code:</div><div class=""><br class=""></div><div class="">1. The standard execution of code (if no errors are thrown) gets more and more nested with every call to a <i class="">throw</i>ing function, causing a pyramid of doom. There’s only two levels in this example, but it could easily be four or five.</div><div class=""><br class=""></div><div class="">2. The first <i class="">try NSFileManager.default</i>… is no less than 20 lines away from its catch statement. Again, with more try statements, this number only increases, making the code very unreadable in my opinion.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><b class="">A possible solution:</b></div><div class=""><br class=""></div><div class="">Allow a <i class="">catch</i> clause to be used directly after any function that <i class="">throw</i>s. This clause includes all the <i class="">catch x {} catch y {}</i> error-handling code. Just like the <i class="">else</i> clause in a <i class="">guard let</i>, this <i class="">catch</i> clause has to return or otherwise break normal execution. Because of this, the overarching do {} catch {} blocks are no longer needed, and normal execution continues without continually increasing code indentation.</div><div class=""><br class=""></div><div class="">This is how the above code snippet might look if this solution was implemented:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(187, 44, 162);">let</span> coordinator = <span class="" style="color: rgb(112, 61, 170);">NSPersistentStoreCoordinator</span>(managedObjectModel: <span class="" style="color: rgb(79, 129, 135);">managedObjectModel</span>)</div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span> documentsDirectoryURL = <span class="" style="color: rgb(187, 44, 162);">try</span> <span class="" style="color: rgb(112, 61, 170);">NSFileManager</span>.<span class="" style="color: rgb(61, 29, 129);">defaultManager</span>().<span class="" style="color: rgb(61, 29, 129);">URLForDirectory</span>(.<span class="" style="color: rgb(61, 29, 129);">DocumentDirectory</span>, inDomain: .UserDomainMask, appropriateForURL: <span class="" style="color: rgb(187, 44, 162);">nil</span>, create: <span class="" style="color: rgb(187, 44, 162);">false</span>) <span class="" style="color: rgb(187, 44, 162);">catch</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> MyError.Case1 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> MyError.Case2 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> MyError.Case3 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span> persistentStoreFileName = <span class="" style="color: rgb(209, 47, 27);">"CoreDataStore.sqlite"</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="" style=""> persistentStoreURL = </span>documentsDirectoryURL<span class="" style="">.</span><span class="" style="color: rgb(61, 29, 129);">URLByAppendingPathComponent</span><span class="" style="">(</span>persistentStoreFileName<span class="" style="">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);"><span class="" style=""><br class=""></span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">try</span> <span class="" style="color: rgb(79, 129, 135);">coordinator</span>.<span class="" style="color: rgb(61, 29, 129);">addPersistentStoreWithType</span>(<span class="" style="color: rgb(112, 61, 170);">NSSQLiteStoreType</span>, configuration: <span class="" style="color: rgb(187, 44, 162);">nil</span>, URL: <span class="" style="color: rgb(79, 129, 135);">persistentStoreURL</span>, options: <span class="" style="color: rgb(187, 44, 162);">nil</span>) <span class="" style="color: rgb(187, 44, 162);">catch</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> AnotherError.Case1 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> AnotherError.Case2 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> AnotherError.Case3 {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(187, 44, 162);">catch</span> {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div></div><div class=""><br class=""></div><div class="">The syntax of the new catch block could certainly be improved on (it might also benefit from typed throwing as discussed in another thread). However, even imperfect, this code is much more readable than what’s currently required, as one can instantly tell which <i class="">try</i> statement goes with which <i class="">catch </i>statements. In addition, the the pyramid of doom is gone, and the resulting code is reminiscent of a function with many <i class="">guard let</i>s.</div><div class=""><br class=""></div><div class="">If you have any feedback or know of potential issues that I’m not aware of, I look forward to hearing from you. Thanks so much!</div><div class=""><br class=""></div><div class="">Liam</div></div><br class="" style="font-family: Helvetica; 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 style="font-family: Helvetica; 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=""><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 9:36 AM, 王巍 via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">The first (current) choice is better in fact.</div><div class=""><br class=""></div><div class="">With try closure out of the scope, you could not tell exactly which statement would throw. </div><div class="">In your example, only `makeSandwich` would throw, so there is no need to mark `eatASandwich` with a `try`.</div><div class=""><br class=""></div><div class="">Current design follows minimal conception very well, you could get to know that only the `makeASandwich` would throw an error, which reduce a lot of noise when reading this code.</div><div class=""><br class=""></div><br class=""><div class=""><div class="" style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="font-family: helvetica, Arial; font-size: 13px; background-color: rgb(255, 255, 255); word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><font face="Helvetica" class=""><span class="" style="color: rgb(81, 81, 81); font-family: Tahoma; font-size: 12px;">Best regards.</span></font></div><div class="" style="font-family: helvetica, Arial; font-size: 13px; background-color: rgb(255, 255, 255); word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><font face="Helvetica" class="">---</font></div><div class="" style="font-size: 13px; background-color: rgb(255, 255, 255); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><font color="#515151" face="Tahoma" class=""><span class="" style="font-size: 12px;"><span class="" style="line-height: 15px;">Sincerely,</span> <br class="" style="line-height: 15px;"><span class="name" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline;">Wei Wang (王巍, @onevcat)<br class=""></span></span></font><a href="http://im.onevcat.com/" class="" style="font-family: Tahoma; font-size: 12px; background-color: inherit; color: rgb(65, 131, 196); text-decoration: none; margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline;">im.onevcat.com</a></div></div></div></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">在 2015年12月7日,下午11:30,Don Arnel via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Is there a reason this format was adopted for error handling:<div class=""><ol class="code-lines" style="border: 0px; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; counter-reset: li 0; line-height: 1.6em; list-style: none; font-family: Helvetica, Arial, sans-serif;"><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><br class=""></li></ol></div><div class=""><ol class="code-lines" style="border: 0px; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; counter-reset: li 0; line-height: 1.6em; list-style: none; font-family: Helvetica, Arial, sans-serif;"><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"><span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">do</span> {</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">try</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">makeASandwich</span>()</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">eatASandwich</span>()</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;">} <span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">catch</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">Error</span>.<span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">OutOfCleanDishes</span> {</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">washDishes</span>()</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -17px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;">} <span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">catch</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">Error</span>.<span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">MissingIngredients</span>(<span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">let</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">ingredients</span>) {</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -17px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">buyGroceries</span>(<span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">ingredients</span>)</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -17px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;">}</code></li></ol><div class=""><br class=""></div></div><div class="">rather than this format:</div><div class=""><br class=""></div><div class=""><ol class="code-lines" style="border: 0px; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; counter-reset: li 0; line-height: 1.6em; list-style: none; font-family: Helvetica, Arial, sans-serif;"><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"><span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">try</span> {</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">makeASandwich</span>()</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">eatASandwich</span>()</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;">} <span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">catch</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">Error</span>.<span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">OutOfCleanDishes</span> {</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -13px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">washDishes</span>()</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -17px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;">} <span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">catch</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">Error</span>.<span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">MissingIngredients</span>(<span class="kt" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145);">let</span> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">ingredients</span>) {</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -17px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;"> <span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">buyGroceries</span>(<span class="vc" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(63, 110, 116);">ingredients</span>)</code></li><li class="" style="border-width: 0px 0px 0px 18px; border-left-style: solid; border-left-color: transparent; margin: 0px; outline: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; text-indent: -17px; white-space: pre-wrap; list-style-type: none;"><code class="code-voice" style="border: 0px; font-size: 0.85em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;">}</code></li></ol><div class=""><br class=""></div></div><div class="">The second format is much more intuitive, and reads easier IMO.</div><div class=""><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=80FydpVXO1iznd7NlD1VGOniZKpUfBnbaLfoowjEmdTW8z0IN1Cv1LKOmSqFvQBMiybXV4oHhmaSb3i0ynt6N6A6BCloOljtUxHTMyyCmkOxboBkezXNHr0GWlw8Y1zCl4kXDTNAeJtV5rsNNm5MKR9RIToQAttvF8vmqqAa-2FMzVva9LTl7HcIVyZKjlbiJtm2oZ-2BKggv4Xg64bAINa7X-2FSkduWWfsXHcnTAdhwONKU-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=FWNXVkJEIvgBIPO6st52oaOhXz8A8SWiAS8uKJuLOYaQ-2FKrkdvOhwYDSb08Z8vkprv4yYXx6DWDgO1O2EqViq42xTFDTC1keUxDCAXC3uMHH9rNpLK1sIt-2BKbdvo3vzsE5SCtu4rxv7SONynCtwbbtpP1goU2JHKwNNOz6Iiol90ut0EyKilrzIdjvgCJ5Ld2aH2taPNhDY6eCR1awH2xw-3D-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; 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;"><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=UNDxqBUDZDpZmPmXfIKeZ1UxMq-2BwsURX5ulfpb2jFAYfnatQEWIgGwg19KOICm4hc9rd844GnkpcHeiPsPpcm-2B-2FvcIe63iCUU3GzFXZVeWVXrT65A1rLJQdgb4mSsrCnBasD06TIUUAVHF3MMKtqTMbSsswMpW-2FuoVYjEa340nBZ-2FnGMpGHhKKW-2FEi-2F5zTw81JxTst6Q9yH39SePz9YmOUw557sARMDYDPNc-2BEI1mts-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; 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; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; 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; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span>_______________________________________________</span><br style="font-family: Helvetica; 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=""><span style="font-family: Helvetica; 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; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; 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=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; 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="">swift-evolution@swift.org</a><br style="font-family: Helvetica; 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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; 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="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></body></html>