This is beautiful: https://forums.swift.org/t/pitch-narrowed-any/86369
Post
@Migueldeicaza `throws(NetworkError | DecodingError | AuthError)` oh fuck yeah
@numist @Migueldeicaza would love that but if it erases to Any it defeats typed throws (let alone that it can’t erase to Any, it needs to erase to Error at the very least)
@fay59 @Migueldeicaza pitch feels too rigorous to fall for that trap? Under the hood I could easily see this getting implementing by generating "union" enums at compile-time for the ABI. That said, SDK compat would remain a problem—can modules ship different interfaces depending on the major language version or sth?
@numist @Migueldeicaza the pitch is AI-generated
@Migueldeicaza We have this feature in Crystal lang (https://crystal-lang.org/reference/1.20/syntax_and_semantics/union_types.html) and it is nice! We can write aliases for Unions too (https://crystal-lang.org/reference/1.20/syntax_and_semantics/alias.html)