[swift-evolution] Move placement of 'throws' statement
clattner at apple.com
Wed Dec 28 22:14:35 CST 2016
> On Dec 28, 2016, at 9:52 AM, Dave Abrahams <dabrahams 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 admit this is a horrible rule from a language designer's point of view
> but there's a chance it could end up being better for users.
Indeed this is horrid for an ivory tower language designer, but the pragmatic among them often have to make concessions to the real world. That said, I think this would be worse for typical swift programmers as well: it introduces multiple ways to do things, which work inconsistently and surprisingly in some cases.
Here is a different way of looking at this: The predictable case is the one we already have now (and we wouldn’t take it away). Is your beef with the current syntax so great that you think it is worth adding complexity to the language to privilege some special cases?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution