As long as the superclass sub-object gets initialized, it shouldn't matter if the initializer was designated or convenience. Is there some subtle step on the two-phase initialization I'm missing? Or is this a point to extend in a future version of Swift?
I think it's some subtlety... I might vaguely remember someone saying something about it. Since a proposal didn't come of that, I'm assuming there was a technical issue or something. I could easily be wrong, though.
- Dave Sweeris
···
On Jul 25, 2017, at 9:36 PM, Daryle Walker via swift-evolution <swift-evolution@swift.org> wrote:
[Sorry if this's been discussed before.]
As long as the superclass sub-object gets initialized, it shouldn't matter if the initializer was designated or convenience. Is there some subtle step on the two-phase initialization I'm missing? Or is this a point to extend in a future version of Swift?
It prevents accidental infinite loops of inits, which is possible in Obj-C.
···
On Jul 26, 2017, at 12:36 AM, Daryle Walker via swift-evolution <swift-evolution@swift.org> wrote:
[Sorry if this's been discussed before.]
As long as the superclass sub-object gets initialized, it shouldn't matter if the initializer was designated or convenience. Is there some subtle step on the two-phase initialization I'm missing? Or is this a point to extend in a future version of Swift?
Convenience initializers are complete-object initializers. A sub-object initializer from a subclass cannot delegate to a complete-object initializer from its superclass because that would re-initialize all the subclass sub-objects.
John.
···
On Jul 26, 2017, at 12:36 AM, Daryle Walker via swift-evolution <swift-evolution@swift.org> wrote:
[Sorry if this's been discussed before.]
As long as the superclass sub-object gets initialized, it shouldn't matter if the initializer was designated or convenience. Is there some subtle step on the two-phase initialization I'm missing? Or is this a point to extend in a future version of Swift?