> On Oct 11, 2016, at 12:04 AM, Karl via swift-evolution 
> <swift-evolution@swift.org> wrote:
>> On 11 Oct 2016, at 08:49, Benjamin Spratling <bspratl...@mac.com 
>> <mailto:bspratl...@mac.com>> wrote:
>> Howdy,
>> The error message is not saying that aFunction throws, it says “??" might 
>> throw.  After all, you supplied a ()rethrows->(Int) to it as its second 
>> argument, which is wrapping a ()throws->Int, “bFunction()"
>> ?? and && and || wrap the trailing expression in an @autoclosure.
>> I am a little surprised two “try” are not required.  This would be my 
>> expectation:
>>> let value = try aFunction() ?? try bFunction()
>> but, using try to the right of a non-assignment operator is not allowed.
>> This, however, is not disallowed:
>> let value = try aFunction() ?? (try bFunction())
>> The purpose of the @autoclosure is to make developers forget they need to 
>> write a closure, and it apparently worked for you.
>> -Ben Spratling
> Yeah, I understand the reason for it, but I still think we should change it 
> so you write the ‘try’ before the part which actually throws. Perhaps the 
> rule should be something more general around rethrowing autoclosures?
> After all, I thought that was the entire point of the ‘try’ keyword. The 
> compiler doesn't really need it (it already knows what throws and what 
> doesn’t), but it helps humans to mark where the throwing stuff happens.

I agree that you should be able to place the try inside the autoclosure and 
have that propagate out.  This doesn't need evolution discussion; please file a 

swift-evolution mailing list

Reply via email to