[swift-dev] [stdlib] Error recovery hook #12025
John Holdsworth
mac at johnholdsworth.com
Wed Sep 20 16:55:33 CDT 2017
Hello Swift developers,
I’ve raised a rather speculative PR suggesting a hook be added to stdlib
that would allow users to experiment with error recovery in their apps.
https://github.com/apple/swift/pull/12025 <https://github.com/apple/swift/pull/12025>
Ultimately it come down to being able to do something like this:
do {
try Fortify.exec {
var a: String!
a = a!
}
}
catch {
NSLog("Caught exception: \(error)")
}
This was primarily intended for user in "Swift on the server" but could also
help avoid crashes in the mobile domain. The rationale and mechanics
are written up at the following url:
http://johnholdsworth.com/fortify.html <http://johnholdsworth.com/fortify.html>
I'll accept this won’t be everybody’s cup of tea but at this stage this is
only an opt-in facilitating patch. Developers need not subject their apps
to this approach which requires a separate experimental implementation.
The recovery is reasonably well behaved except it will not recover
objects and system resources used in intermediate frames, It’s not
as random as something like, for example, trying to cancel a thread.
The debate about whether apps should try to soldier on when something
is clearly amiss is a stylistic one about which there will be a spectrum of
opinions. The arguments weigh more in favour in the server domain.
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170920/36f77450/attachment.html>
More information about the swift-dev
mailing list