2017-02-19 22:59 GMT+03:00 Matthew Johnson <[email protected]>:

On Feb 19, 2017, at 1:32 PM, Anton Zhilin <[email protected]> wrote:
>
> Now that I think about it, generic throws does not exactly cover rethrows.
> Firstly, rethrows has semantic information that function itself does not
> throw—it would be lost.
>
> Can you elaborate further on what you mean by this?
>
protocol Default { init() }

func exec(f: () throws -> Void) rethrows
{
    try f()
    throw MyError()  // error because of rethrows
}

func exec<E>(f: () throws(E) -> Void) throws(E)
     where E: Error & Default
{
    try f()
    throw E()  // okay
}

​
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to