<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">It isn’t clear to me how much value this actually adds in a server domain. Inability to recover resources means you may immediate run into deadlocks, for example, so any robust server strategy will end up having to still handle that. If that machinery has to be in place regardless, why not use it for the existing error conditions.<div class=""><br class=""></div><div class="">Do you have any thoughts there?</div><div class=""><br class=""></div><div class=""> - Daniel<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 20, 2017, at 2:55 PM, John Holdsworth via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</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="">Hello Swift developers,<div class=""><br class=""></div><div class="">I’ve raised a rather speculative PR suggesting a hook be added to stdlib</div><div class="">that would allow users to experiment with error recovery in their apps.</div><div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift/pull/12025" class="">https://github.com/apple/swift/pull/12025</a></div><div class=""><br class=""></div><div class="">Ultimately it come down to being able to do something like this:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">do</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">try</span> <span style="color: #4f8187" class="">Fortify</span>.<span style="color: #31595d" class="">exec</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">var</span> a: <span style="color: #703daa" class="">String</span>!</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> a = a!</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">catch</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3e1e81" class="">NSLog</span>(<span style="color: #d12f1b" class="">"Caught exception: </span>\<span style="color: #d12f1b" class="">(</span>error<span style="color: #d12f1b" class="">)"</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div></div><div class=""><br class=""></div><div class="">This was primarily intended for user in "Swift on the server" but could also</div><div class="">help avoid crashes in the mobile domain. The rationale and mechanics</div><div class="">are written up at the following url:</div><div class=""><br class=""></div><div class=""><a href="http://johnholdsworth.com/fortify.html" class="">http://johnholdsworth.com/fortify.html</a></div><div class=""><br class=""></div><div class="">I'll accept this won’t be everybody’s cup of tea but at this stage this is</div><div class="">only an opt-in facilitating patch. Developers need not subject their apps</div><div class="">to this approach which requires a separate experimental implementation.</div><div class=""><br class=""></div><div class="">The recovery is reasonably well behaved except it will not recover </div><div class="">objects and system resources used in intermediate frames, It’s not</div><div class="">as random as something like, for example, trying to cancel a thread.</div><div class=""><br class=""></div><div class="">The debate about whether apps should try to soldier on when something</div><div class="">is clearly amiss is a stylistic one about which there will be a spectrum of</div><div class="">opinions. The arguments weigh more in favour in the server domain.</div><div class=""><br class=""></div><div class="">John</div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></div></body></html>