Re: Referring to self in property initializer
Re: Referring to self in property initializer
- Subject: Re: Referring to self in property initializer
- From: Quincey Morris <email@hidden>
- Date: Sat, 15 Aug 2015 00:44:41 +0000
On Aug 14, 2015, at 17:26 , Jens Alfke <email@hidden> wrote:
>
> (Either way, it would still make sense for ‘self’ to be available.)
Yes and no. Because it’s an ivar, the ivar’s value is associated with an instance rather than a class, but:
— It’s being initialized by an arbitrary closure. There’s no particular reason to regard the closure as associated with any specific instance.
— It’s initializing an ivar. There’s no (accessible) ‘self’ object until all of the class’s own ivars are initialized. Similarly, in an initializer, you cannot assign ‘self’ to anything, until all ivars are initialized. So even if ‘self’ was taken to mean “the” instance, it would still be an error.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden