• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Referring to self in property initializer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Referring to self in property initializer
      • From: Rick Mann <email@hidden>
References: 
 >Referring to self in property initializer (From: Rick Mann <email@hidden>)
 >Re: Referring to self in property initializer (From: Quincey Morris <email@hidden>)
 >Re: Referring to self in property initializer (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Referring to self in property initializer
  • Next by Date: Re: Recurrent NSInvocationOperations on an NSOperationQueue?
  • Previous by thread: Re: Referring to self in property initializer
  • Next by thread: Re: Referring to self in property initializer
  • Index(es):
    • Date
    • Thread