Re: [swift-users] Rethrows issue

2018-01-01 Thread Howard Lovatt via swift-users
I don’t get why that type checks: 1. rescue always throws inside sync, therefore 2. _syncHelper inside sync always throws, therefore 3. sync always throws, therefore 4. Shouldn’t sync be declared throws not rethrows? -- Howard. On 1 Jan 2018, at 1:10 pm, Charles Srstka via swift-users

Re: [swift-users] Rethrows issue

2018-01-01 Thread Charles Srstka via swift-users
> On Dec 31, 2017, at 1:35 AM, Nevin Brackett-Rozinsky via swift-users > wrote: > > So, I know this doesn’t actually address your issue, but I think it is > important to clarify that “rethrows” does not guarantee anything about the > *type* of error thrown by a function. What “rethrows” implie

Re: [swift-users] Rethrows issue

2017-12-31 Thread Kenny Leung via swift-users
How about this? func withPredicateErrors( _ predicate: @escaping (Element) throws -> Bool, do body: ((Element) -> Bool) -> Return ) rethrows -> Return { var caught: Error? var element: Element? let value = body { elem in element = elem do {

Re: [swift-users] Rethrows issue

2017-12-31 Thread Jacob Bandes-Storch via swift-users
On Sat, Dec 30, 2017 at 11:35 PM, Nevin Brackett-Rozinsky via swift-users < swift-users@swift.org> wrote: > So, I know this doesn’t actually address your issue, but I think it is > important to clarify that “rethrows” does not guarantee anything about the > *type* of error thrown by a function. Wh

Re: [swift-users] Rethrows issue

2017-12-30 Thread Nevin Brackett-Rozinsky via swift-users
So, I know this doesn’t actually address your issue, but I think it is important to clarify that “rethrows” does not guarantee anything about the *type* of error thrown by a function. What “rethrows” implies is that the function *will not throw* unless at least one of its arguments throws. In part

[swift-users] Rethrows issue

2017-12-30 Thread Brent Royal-Gordon via swift-users
I need to do something like this: func withPredicateErrors(_ predicate: (Element) throws -> Bool, do body: ((Element) -> Bool) -> Return) rethrows -> Return { var caught: Error? let value = body { elem in do { return try predicate(elem)