I sense s disturbance in the force as if hundreds of pure functional programmers cried in anger ;).
Sent from my iPhone > On 28 Dec 2016, at 17:52, Dave Abrahams via swift-evolution > <[email protected]> wrote: > > >> on Tue Dec 27 2016, Chris Lattner <clattner-AT-apple.com> wrote: >> >> On Dec 26, 2016, at 2:55 PM, Dave Abrahams via swift-evolution >> <[email protected]> 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 > > 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. > Functions-that-return-functions are, after all, the 0.1% case. > > -- > -Dave > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
