• 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: There's obviously something I don't understand about autorelease.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: There's obviously something I don't understand about autorelease.


  • Subject: Re: There's obviously something I don't understand about autorelease.
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 17 Mar 2012 21:06:49 -0700

On Mar 17, 2012, at 20:03 , Ken Thomases wrote:

> It's an important part of the semantics of a property whether it holds a strong or weak reference.

On Mar 17, 2012, at 20:04 , Greg Parker wrote:

> The memory management behavior of a property frequently is part of the public interface. For example, if you want to understand your retain cycles then it's important to know which properties are strong and which are weak. Or if you have a mutable string then it's important to know which properties are retaining and which are copying.


Yes, there's important information, but -- correct me if I'm wrong -- what you really need to know is:

	What ownership stake does the property taken in objects you set as values?

In the pre-ARC retain/release memory model, 'retain' meant "takes ownership" and 'assign' meant "doesn't take ownership", and there weren't any strong or weak references as such.

In ARC, the client still doesn't really care about the kind of *reference* the implementation holds internally. It still only cares whether setting the property affects retain cycles, as you said. It only cares about ownership.

In particular, if the client is ARC but the class implementation isn't, a so-called strong property just retains its ivar and a so-called weak property doesn't.

I shouldn't have suggested that property declarations didn't need memory management attributes, but all of the current attributes are "wrong" (because they do double-duty as ivar reference attributes). I *think* the "right" property attributes should be exactly one of the following list per declaration:

	owning
	nonowning
	copying
	readonly
	readwrite,owning
	readwrite,nonowning
	readwrite,copying

If we choose to use "strong" and "weak" for the first two of these, and forcing double duty as ivar attributes on them, that's OK by me. I just wonder how many people think that if you access (i.e. read) the value of a "weak" property, you "get back" a "weak reference".



_______________________________________________

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

References: 
 >Re: There's obviously something I don't understand about autorelease. (From: G S <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Roland King <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Richard Somers <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Roland King <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Greg Parker <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Roland King <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Quincey Morris <email@hidden>)
 >Re: There's obviously something I don't understand about autorelease. (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: There's obviously something I don't understand about autorelease.
  • Next by Date: Re: There's obviously something I don't understand about autorelease.
  • Previous by thread: Re: There's obviously something I don't understand about autorelease.
  • Next by thread: Re: There's obviously something I don't understand about autorelease.
  • Index(es):
    • Date
    • Thread