[swift-users] [swift-evolution] for-else syntax
Jérôme Duquennoy
jerome+swift at duquennoy.fr
Sun Feb 5 04:41:32 CST 2017
> It would be nice for Swift to support Tcl-like exceptional return codes so we can build control flow functions that work with break, continue, and return properly.
Wouldn't that collide in some way with the error handling mechanism already present in swift ?
Today, you can return a value, possibly optional to return nil if the method might not be able to find the requested value, or to compute it, or you can throw errors for invalid situations. You can then fine tune your errors, to denote an error case (hopefully with some details), a break case, ...
Uniform and coherent error handling is not easy to achieve, I fear that adding another way to report and handle them would not help in that regard.
Jerome
More information about the swift-users
mailing list