[swift-evolution] Move placement of 'throws' statement
Chris Lattner
clattner at apple.com
Wed Dec 28 00:13:16 CST 2016
On Dec 26, 2016, at 2:55 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> // Move `throws` to the end
>> func baz() -> String throws
>
> I agree that reads much better.
This doesn’t work unless you’re willing to break consistency with function type syntax, or if you’re willing to make function [type/decl] syntax ambiguous.
How would you express this, for example?
let x : (_ a : Int) throws -> (_ b: Float) throws -> Double
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
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161227/b2d07673/attachment.html>
More information about the swift-evolution
mailing list