# \[Pre-Pitch\] Arithmetic operators that emit NIL on overflow

**URL:** <https://forums.swift.org/t/pre-pitch-arithmetic-operators-that-emit-nil-on-overflow/30676>\
**Category:** Pitches\
**Tags:** numerics\
**Created:** [November 11, 2019, 3:13am UTC](https://forums.swift.org/t/pre-pitch-arithmetic-operators-that-emit-nil-on-overflow/30676 "2019-11-11T03:13:22Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![DevAndArtist](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/devandartist/32/287_2.png) [@DevAndArtist](https://forums.swift.org/u/DevAndArtist)\
**Post date:** [November 12, 2019, 8:33am UTC](https://forums.swift.org/t/pre-pitch-arithmetic-operators-that-emit-nil-on-overflow/30676/7 "2019-11-12T08:33:21Z")

</div>

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?

```swift
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:

> [@Pitch: Genericizing over annotations like throws](https://forums.swift.org/t/pitch-genericizing-over-annotations-like-throws/20376/10):
>
> Another interesting future direction we could take to address polymorphism over throws specifically would be to adopt typed throws, and make the error type an independent type argument of all function types. This would mean that a type that doesn't throw effectively throws Never, and one that throws without a type by default throws Error: (X, Y, Z) -\> W === (X, Y, Z) throws Never -\> W (X, Y, Z) throws -\> W === (X, Y, Z) throws Error -\> W This would allow protocols to be generic over thr…

---

_[View the full topic](https://forums.swift.org/t/pre-pitch-arithmetic-operators-that-emit-nil-on-overflow/30676)._
