Why can't Int.init() take an optional StringProtocol?

As I recall, in the last thread about it (Unwrapped Arguments for Functions), there was broad agreement that postfix-? was the right spelling.

Prior discussions had bogged down in debating evaluation order and short-circuiting, but then Rob Mayoff observed that we have already answered exactly those questions for try, and it would make sense to match the behaviors:

Since throwing in argument position will short-circuit and prevent evaluation of subsequent arguments, it follows that a nil argument with postfix-? should do the same.

If that is something we want in the language, I believe the spelling and behavior are essentially nailed down. It’s just a matter of making it happen.

5 Likes