When we started on an implementation when the last pitch came up, we noticed that throws SomeError
introduces some parsing ambiguities, because of contextual keywords. Here is an example that would be ambiguous to parse:
protocol Foo {
func bar() throws
mutating
func baz()
}
Here we could either parse func bar() throws (mutating)
and func baz()
, or func bar() throws
and mutating func baz()
. I’m sure we could come up with some rules to disambiguate, but we thought at the time that it would be easiest to avoid ambiguities altogether. If more people called for the throws SomeError
syntax though, it would be possible to rethink that for sure.