Revisiting Union Types in Swift for typed throws

It is also incompatible one with of the main motivations for introducing typed throws in the first place (i.e. embedded swift). From SE-413

Existential error types incur overhead

Untyped errors have the existential type any Error, which incurs some necessary overhead, in code size, heap allocation overhead, and execution performance, due to the need to support values of unknown type. In constrained environments such as those supported by Embedded Swift, existential types may not be permitted due to these overheads, making the existing untyped throws mechanism unusable in those environments.

1 Like