> On Oct 19, 2014, at 00:19 , Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Oct 18, 2014, at 23:46 , Rick Mann <rm...@latencyzero.com> wrote:
>> 
>> The rules on initializers don't make sense to me, in all honesty.
> 
> Yes, but that tells us more about you than about Swift — specifically, it 
> tells us that you’re more focused on what would ease your coding task in this 
> one case than on embracing more formal relationships between initializers. 
> Understandable, but not really useful to anyone else, if you’ll forgive my 
> saying so.
> 
>> If you imagine that instantiating the base class by calling any of the 
>> initializers results in a completely instantiated object, the subclass 
>> should also be able to call any of the inherited initializers.
> 
> Yes, but …
> 
> (It’s all about the “yes, but”s.)
> 
> … calling *up* from a subclass convenience initializer bypasses all of the 
> subclass designated initializers (except in the case that the subclass 
> overrides some or all of the superclass's, which introduces its own semantic 
> ambiguities). That means that the subclass can’t be sure it initialized its 
> own properties, since that’s the purview of designated initializers — at 
> least not without supplementary rules. That in turn destroys the integrity of 
> Swift’s 2-pass initialization process.

Well, I'm not sure I agree with that. Every initializer in a class should work 
correctly. An external caller can initialize a class by calling any of its init 
methods, why can't a subclass?

At the very least, NSWindowController's choice of designated initializer 
increases the burden on subclasses.

-- 
Rick Mann
rm...@latencyzero.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to