Thanks for doing the analysis. I was actually teetering on the brink of agreeing maybe allowing return
wasn't such a good idea and we could drop that part – and this post pulled me back to thinking it's a good idea.
Another reason is, there's a particular form in Swift that would benefit from return
... failable initializers. Which are often of the form "either assign something to self
, or return nil
from this function", e.g.
init?(rawValue: String) {
self = switch rawValue {
case "foo": 1
case "bar": 2
case "baz": 3
default: return nil
}
}
It'd be a shame to require them to lose the benefit of this proposal.