[swift-evolution] Remove Failable Initializers

Tino Heth 2th at gmx.de
Mon Mar 7 08:27:16 CST 2016


+1
Without "try?", it would be really inconvenient to not have "init?" — but failable initializers as they are now are somewhat odd, because they are half-function and half-procedure:
Regular init-methods have no return, so you can basically think of them as a configuration that is called on an allocated object.
This isn't true anymore for "init?", as it not only it turns a "void-function" into something that returns an optional, but also doesn't explicitly model the non-nil case (there is no "return self").
Replacing this mechanism with an error would actually make initializers more method-like, and less special.

Tino


More information about the swift-evolution mailing list