<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><blockquote type="cite" class=""><div class="">On Dec 4, 2015, at 4:04 PM, Manav Gabhawala &lt;<a href="mailto:manav1907@gmail.com" class="">manav1907@gmail.com</a>&gt; wrote:</div><div class=""><div class="bloop_original_html" style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);"><div id="bloop_customfont" style="margin: 0px;" class=""><font face="Helvetica" class="">irst of all, Swift is an absolute dream of a programming language and is&nbsp;really taking the future of programming in the right direction.</font></div><div id="bloop_customfont" style="margin: 0px;" class=""><font face="Helvetica" class=""><br class=""></font></div><div id="bloop_customfont" style="margin: 0px;" class=""><font face="Helvetica" class="">However, it&nbsp;seems backwards to me that everything in swift is type safe and complete (like enum cases) but error handling seems lacking on that end. It would be a huge feature if the compiler could infer the types of errors&nbsp;functions throw and make sure you catch all the different types of errors at the call site. The compiler could also chain the types through multiple throwing function callers. This feature would require no extra work on the programmers part because the compiler would infer the types of errors being thrown. For example,</font></div></div></div></blockquote><div><br class=""></div>This is a global type-checking problem. &nbsp;It’s completely blocked by any dynamic features (like protocol or class methods) and library boundaries, so outside of toy examples, you will end up needing exhaustive pattern-matching pretty much everywhere.</div><div><br class=""></div><div>John.</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="bloop_original_html" style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);"><div id="bloop_customfont" style="margin: 0px;" class=""><font face="Helvetica" class=""><br class=""></font></div><div class=""><div style="font-family: Menlo, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div id="bloop_customfont" style="font-family: Menlo, Arial; font-size: 13px; 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; margin: 0px;" class=""><font face="Menlo" class=""><br class="Apple-interchange-newline">func foo() throws</font></div></div><div style="font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div id="bloop_customfont" style="font-family: Menlo, Arial; font-size: 13px; 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; margin: 0px;" class=""><font face="Menlo" class="">{</font></div><div id="bloop_customfont" style="font-size: 13px; 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; margin: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>...</div><div id="bloop_customfont" style="font-size: 13px; 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; margin: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>throw ErrorType1.BadRequest</div><div id="bloop_customfont" style="font-size: 13px; 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; margin: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>...</div><div id="bloop_customfont" style="font-size: 13px; 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; margin: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>throw ErrorType1.NoAuthentication</div><div id="bloop_customfont" style="font-size: 13px; 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; margin: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>...</div><div id="bloop_customfont" style="font-size: 13px; 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; margin: 0px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>throw ErrorType2.NoResourceFound</div></div></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">}</span><br class="Apple-interchange-newline"></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">func main()</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">{</span></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>do&nbsp;</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>foo()</span></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>catch (ErrorType1.BadRequest)</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">                </span></span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div class=""></div><div class=""></div><div class=""></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>catch (ErrorType2.NoResourceFound)</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>{</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>// Compiler error because ErrorType1.NoAuthentication is not included.</span></div><div class=""><span style="font-size: 13px; 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; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">}</span></div><div id="bloop_customfont" style="margin: 0px;" class=""><font face="Helvetica" class=""><br class=""></font></div><div id="bloop_customfont" style="margin: 0px;" class=""><font face="Helvetica" class="">Errors can also be chained together such&nbsp;that each function&nbsp;statically identifies the types thrown and if a call is made to a&nbsp;throwing function all the uncaught types are&nbsp;propagated out of the call stack. This would firstly be beneficial because we&nbsp;wouldn’t need the ridiculous empty catch { } block at the end that most people end up doing and secondly would&nbsp;ensure programmers are completely and always aware the possible errors that&nbsp;can be thrown by the function calls they&nbsp;make.</font></div><br class=""><div class="bloop_sign" id="bloop_sign_1449271833304600832"><div class=""><font face="HelveticaNeue" class="">Regards,<br class="">Manav</font><br class=""></div></div></div><div class="bloop_markdown" style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);"><div style="margin: 15px 0px; -webkit-margin-before: 0px;" class=""><br class="webkit-block-placeholder"></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=hWKWvOREWCPT32eVzNXOV7yIWXgGOvlMtgjKbOieJnbWHl-2B0UwgUMiYzAHziBSgcDU3puY3-2B-2Bsa1Y-2F3ni70yWW5Trk-2ByQXb6TzTP1LQ0HHXxoSO31l6XHuMpc-2Be-2FnBYHxqe6MTckA8JQ3pgPNFahpTmRdsDdcD7YTOQxJqoIZLPl60x0KmWJkGmccK6EkmeXlH2FnKduazJV5N1rhloD6QakIZUjK9150jBJbQYT6XE-3D" alt="" width="1" height="1" border="0" style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254); height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254); float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);" class=""><span style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254); float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);" class=""><a href="mailto:swift-evolution@swift.org" style="color: rgb(65, 131, 196); background-color: rgb(254, 254, 254); text-decoration: none; font-family: Menlo, Arial; font-size: 13px; 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: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color: rgb(65, 131, 196); background-color: rgb(254, 254, 254); text-decoration: none; font-family: Menlo, Arial; font-size: 13px; 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><br style="font-family: Menlo, Arial; font-size: 13px; 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; background-color: rgb(254, 254, 254);" class=""></div></blockquote></div><br class=""></body></html>