[swift-evolution] Move placement of 'throws' statement

Guillaume Lessard glessard at tffenterprises.com
Wed Dec 28 12:40:16 CST 2016


> On 28 déc. 2016, at 10:52, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> on Tue Dec 27 2016, Chris Lattner <clattner-AT-apple.com> wrote:
> 
>> it would be ambiguous to move the ‘throws’ keyword to the end of the
>> function type, because you'd get:
>> 
>> 	let x : (_ a : Int) -> (_ b: Float) -> Double throws throws
> 
> I see.  
> 
> We *could* say that the "throws" keyword comes after the return type
> unless it's a function type, in which case it comes after the return
> type's parameter list
> 
>       let x : (_ a : Int) -> (_ b: Float) throws -> Double throws

I can’t parse this at all; which is which?
Could you illustrate this strange rule to return (a) a non-throwing function from a throwing function, and (b) a throwing function from a non-throwing function?

Cheers,
Guillaume Lessard



More information about the swift-evolution mailing list