<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 7, 2017, at 11:22 AM, Letanyan Arumugam <<a href="mailto:letanyan.a@gmail.com" class="">letanyan.a@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="Singleton" style="word-wrap: break-word; -webkit-nbsp-mode: space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space;"><div class=""><blockquote type="cite" class=""><div class=""><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""><div class="">fatalError shouldn’t be used excessively. API surface areas for these types are going to be massive (infinite technically). I assume many people are going to be writing a lot of code would these types and calling many methods and properties which would all essentially have a fatalError. Would you consider it good code if the majority of all your types had methods defined with fatalError calls.</div></div></div></blockquote><div dir="auto" class=""><br class=""></div><div dir="auto" class="">What is the basis for this claim? Probably the majority of standard library methods check preconditions and trap on failure. That is how I write my code as well.</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><br class=""></blockquote></div></div></div></blockquote><br class=""></div><div class="">I’m talking specifically about fatalError not precondition. fatalError is something that goes out with production code while precondition is used for debugging. I think you would agree a shipped program that has many states of being unrecoverable is not a good design?</div></div></div></blockquote><br class=""></div><div class="">You are aware that Int traps on overflow and arrays trap on out of bounds, right?</div><div class=""><br class=""></div></div></div></blockquote><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div class="">Were each of them not decided upon separately based on certain tradeoffs? Arrays for speed and Int overflow because having the addition operator return an optional would be too cumbersome? If these reasons were not so influential would they still be designed to trap?</div></div></div></blockquote></div><br class=""><div class="">Yes, each of these decisions was carefully made. </div><div class=""><br class=""></div><div class="">My point is that pretty much all code can fail at runtime, including "something that goes out with production code”, because integers and arrays are pervasive. I do not understand your claim that Swift APIs do not generally fail at runtime.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div></body></html>