[swift-users] Failable initializers - conflicting info?

tuuranton at tutanota.de tuuranton at tutanota.de
Wed Jan 25 16:31:23 CST 2017


I'm looking at the docshttps://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-ID203

1st they say
"A failable initializer can also delegate to a nonfailable initializer. Use this approach if you need to add a potential failure state to an existing initialization process that does not otherwise fail."
2nd they say
"You can override a failable initializer with a nonfailable initializer but not the other way around."
This is not strictly conflicting info. But what is so special about OVERRIDDEN intializers? What is a good reason for why we cannot override a nonfailable initializer with a failable initializer? There must be some intuitive explanation that I'm missing.
To clarify what I mean, here is the "conflict" I'm talking about:
According to the 1st, this is possible:
FAILABLE calls super.NONFAILABLE
But according to the 2nd, 1st is only possible if FAILABLE does not OVERRIDE super.NONFAILABLE.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170125/3fc380d9/attachment.html>


More information about the swift-users mailing list