<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=""><div class="">Hey Kametrixom,</div><div class=""><br class=""></div><div class="">Thanks for the feedback! I agree that the proposed syntax needs improvement.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(53, 86, 138);">guard</span> <span class="" style="color: rgb(53, 86, 138);">let</span> unwrapped = optional, result = <span class="" style="color: rgb(53, 86, 138);">try</span> test() <span class="" style="color: rgb(53, 86, 138);">else</span> {</div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> SomeError.SomeCase {</div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; color: rgb(53, 86, 138);"><span class="">} </span>catch<span class=""> {</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal;">}</div></div></div></div></blockquote></div><div class=""><br class=""></div><div class="">I like this example, but it seems rather specific. Are you just using the <span class="" style="font-family: Menlo; color: rgb(53, 86, 138);">guard</span><span style="font-family: Menlo;" class=""> </span><span class="" style="font-family: Menlo; color: rgb(53, 86, 138);">let</span><span style="font-family: Menlo;" class=""> unwrapped = optional </span>to show how <i class="">guard let</i> and the <i class="">catch</i> block could be used together, or suggesting that guard let should be required for this functionality? If the latter, how would we handle throwing functions that don’t return a value?</div><div class=""><br class=""></div><div class="">I’m fine with removing the enclosing catch { } from my original suggestion; perhaps something like this? My only concern with this is that it’s slightly confusing to have the first <i class="">catch X</i> on the same line as the <i class="">try</i> call.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><div class="" style="margin: 0px; line-height: normal;">let result = <span class="" style="color: rgb(53, 86, 138);">try</span> test() <span class="" style="color: rgb(53, 86, 138);">catch</span> SomeError.SomeCase {</div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; color: rgb(53, 86, 138);"><span class="">} </span>catch<span class=""> {</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal;">}</div></div></div></div></blockquote></div><div class=""><br class=""></div><div class="">Also, regarding the new syntax being redundant:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(53, 86, 138);">let</span> coordinator = <span class="" style="color: rgb(195, 89, 0);">NSPersistentStoreCoordinator</span>(managedObjectModel: managedObjectModel)</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(53, 86, 138);">do</span> {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(53, 86, 138);">let</span> documentsDirectoryURL = <span class="" style="color: rgb(53, 86, 138);">try</span> <span class="" style="color: rgb(195, 89, 0);">NSFileManager</span>.<span class="" style="color: rgb(88, 126, 168);">defaultManager</span>().<span class="" style="color: rgb(88, 126, 168);">URLForDirectory</span>(.<span class="" style="color: rgb(88, 126, 168);">DocumentDirectory</span>, inDomain: .UserDomainMask, appropriateForURL: <span class="" style="color: rgb(53, 86, 138);">nil</span>, create: <span class="" style="color: rgb(53, 86, 138);">false</span>)</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(53, 86, 138);">let</span> persistentStoreFileName = <span class="" style="color: rgb(232, 35, 0);">"CoreDataStore.sqlite"</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(53, 86, 138);">let</span> persistentStoreURL = documentsDirectoryURL.<span class="" style="color: rgb(88, 126, 168);">URLByAppendingPathComponent</span>(persistentStoreFileName)</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(53, 86, 138);">try</span> <span class="" style="color: rgb(88, 126, 168);">coordinator</span>.addPersistentStoreWithType(<span class="" style="color: rgb(88, 126, 168);">NSSQLiteStoreType</span>, configuration: <span class="" style="color: rgb(53, 86, 138);">nil</span>, URL: persistentStoreURL, options: <span class="" style="color: rgb(53, 86, 138);">nil</span>)</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> MyError.Case1 {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> MyError.Case2 {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> MyError.Case3 {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> AnotherError.Case1 {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> AnotherError.Case2 {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">} <span class="" style="color: rgb(53, 86, 138);">catch</span> AnotherError.Case3 {</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(53, 86, 138);"><span class="">} </span>catch<span class=""> {</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;"> <br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;">}</div></div></div></blockquote><br class=""></div><div class="">Thanks for pointing out this possibility. However, this code makes it even harder to decipher where MyError will be thrown from. How about AnotherError– which function threw that? No way to know. In certain cases that may not be an issue, but what if the error handling code presented a UI error? I might want to know more than just what the error is, but the context in which it was generated as well. Putting all the catch blocks at the end directly impacts readability.</div><div class=""><br class=""></div><div class="">As an extension of this issue, suppose that both throwing functions threw the same kind of error. If I want to use a different response based on which function call actually threw the error, I simply can’t do that using this method.</div><div class=""><br class=""></div><div class="">Look forward to hearing your thoughts. Thanks again!</div><div class=""><br class=""></div><div class="">Liam</div><div class=""><br class=""></div><div style=""><blockquote type="cite" class=""><div class="">On Dec 7, 2015, at 10:49 AM, Kametrixom Tikara <<a href="mailto:kametrixom@icloud.com" class="">kametrixom@icloud.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Liam<div class=""><br class=""></div><div class="">I really like that idea, maybe the syntax needs a bit of adjustment. What do you think about this:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">guard</span> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> unwrapped = optional, result = <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">try</span> test() <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">else</span> {</div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> SomeError.SomeCase {</div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; color: rgb(53, 86, 138);" class=""><span style="" class="">} </span>catch<span style="" class=""> {</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal;" class="">}</div></div></div><div class=""><br class=""></div><div class="">However I don’t really know if this is needed since it’s possible to call as many throwing functions as you want in a do-catch block:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> coordinator = <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">NSPersistentStoreCoordinator</span>(managedObjectModel: managedObjectModel)</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">do</span> {</div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> documentsDirectoryURL = <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">try</span> <span style="font-variant-ligatures: no-common-ligatures; color: #c35900" class="">NSFileManager</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">defaultManager</span>().<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">URLForDirectory</span>(.<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">DocumentDirectory</span>, inDomain: .UserDomainMask, appropriateForURL: <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">nil</span>, create: <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">false</span>)</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> persistentStoreFileName = <span style="font-variant-ligatures: no-common-ligatures; color: #e82300" class="">"CoreDataStore.sqlite"</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">let</span> persistentStoreURL = documentsDirectoryURL.<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">URLByAppendingPathComponent</span>(persistentStoreFileName)</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""> <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">try</span> <span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">coordinator</span>.addPersistentStoreWithType(<span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" class="">NSSQLiteStoreType</span>, configuration: <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">nil</span>, URL: persistentStoreURL, options: <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">nil</span>)</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> MyError.Case1 {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> MyError.Case2 {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> MyError.Case3 {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> AnotherError.Case1 {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> AnotherError.Case2 {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">} <span style="font-variant-ligatures: no-common-ligatures; color: #35568a" class="">catch</span> AnotherError.Case3 {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(53, 86, 138);" class=""><span style="" class="">} </span>catch<span style="" class=""> {</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">Which makes the need of such a feature redundant. I really like the idea and would love this to be added :)</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 07 Dec 2015, at 16: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=UMghxGHOvTEcVGG3PKHzuJe-2F1jwKPcDcSNH0SiRhP14efm2rg3VN23A4VXqdP-2B7orIRyJQKvbO3ps-2BSrqWGI-2BRqG3rkoeV5q46Eipa2Mx-2F-2B7rY1J0KN7MuNRB8jLyIWotkDQ0lCMhoCQ8X6GtRRR4PLPvoRBp5VdgAJtRUBg3OgSk11dYWbbhN5myO-2FmiZZ-2FGIJBRPsLUWfPsnAVLttgeJxFIBTSwzRodSV-2B9MxnEao-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></div></div></blockquote></div><br class=""></body></html>