The best way to deal with such situations should be typed throws. Then
rethrows should be removed and replaced with generics in throws clause. E
== Never ⇔ function does not throw.

struct FStore<E> {
    let f: () throws(E) -> Void
    init(_ f: @escaping () throws(E) -> Void) { self.f = f }
    func call() throws(E) { try f() }
}

let store = FStore<Never>({ print("Hello") })
store.call()

[Phase2]
​
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to