Might be a stupid quick thought, but what if we had typed throws and every non throwing operation would technically equal throws Never
and the underlying fatalErrors calls would be rewritten to throws fatalError(...)
, could we start to explicitly opt in and catch fatal errors?
let (lhs, rhs): (UInt8, UInt8) = (.max, 1)
let sum: UInt8
do {
sum = try (lhs + rhs)
} catch {
// would this work?
}
If that‘s not that unreasonable, then we wouldn‘t need a whole new set of arithmetic operators and overloads.
Borrowed some parts from this idea: