2017-02-19 0:16 GMT+03:00 Martin Waitz <t...@admingilde.org>: > > Now some bike-shedding: > I’m not really happy with the `throws(Type)` syntax, as it is too close to > function parameters. > Why exactly is `throws Type` ambiguous? > The proposal mentions `Type -> Result` as potential thrown type, but > functions cannot conform to `Error`. >
Well, it's expected to change with one of the follow-up proposals. > Maybe we can instruct the parser to just allow simple type names between > `throws` and the arrow `->`. > The ambiguity here is not so "to compiler" as "to human". We don't want people to spend extra time parsing the declaration. If that is not possible, we should at least try to find some visual hints > to separate Error type from function parameters. > > E.g. we could use brackets (think of: we are specialising the `throws`): > > func foo() throws<MyError> { … } > I personally prefer parentheses, because there is precedence of parametrized attributes. I wonder what others think on angle brackets option.
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution