• 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: Properties, Attributes and Retain+Autorelease
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Properties, Attributes and Retain+Autorelease


  • Subject: Re: Properties, Attributes and Retain+Autorelease
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 29 Jun 2011 12:50:28 -0700

On Jun 29, 2011, at 12:08, Markus Hanauska wrote:

> I personally think a getter should always [snip] ...

You know, in the Cocoa world, we play with live ammo. When we are handed a pointer without ownership, we go ahead and use it for a while without taking ownership. For as long as we do that, it's ticking and if we run out of time it's going to explode.

What keeps us from losing our thumbs, most of the time, are ... well ... rules of thumb, supported by best practices for things like returning object values from property getters. It's all fragile, but trips to the emergency room are very infrequent if we take just a little bit of care.

You're looking for provable correctness. That's laudable, and will probably mean that you keep all of your fingers. But you'll still end up in the emergency room -- in your case it will be for a stress-induced ulcer. :)

> Which brings me back to my original questions, e.g. whether an "assign" property returns values retain+autorelease when atomic and not when nonatomic... or does it always return the value not retain+autorelease since "assign" properties ignore the nonatomic flag anyway, since there is nothing to be done, they are atomic anyway by definition.

TBH, if you think the purpose of 'atomic' is to protect the retain/release behavior of instance variables, I think you're dead wrong. It's to protect the integrity of the instance variable value, which is potentially corruptible in multi-threaded use of setters. If the current synthesized atomic setter implementation behavior is to atomicize the retain count adjustment too, that's nice, but not essential, since retain/release are themselves atomic. As you've spent some time pointing out, the issues with retain counts exist at a higher level than atomicity.

That's also true of thread safety. The real issues are almost all at a higher level than atomicity.

Excuse me for saying this, but I think this particular discussion has gone on too long. You're not going to get any new answers to your questions, because there are no answers to give beyond what's already been said.


_______________________________________________

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: Properties, Attributes and Retain+Autorelease
      • From: Markus Hanauska <email@hidden>
References: 
 >Re: Properties, Attributes and Retain+Autorelease (From: Matt Neuburg <email@hidden>)
 >Re: Properties, Attributes and Retain+Autorelease (From: Markus Hanauska <email@hidden>)
 >Re: Properties, Attributes and Retain+Autorelease (From: Kyle Sluder <email@hidden>)
 >Re: Properties, Attributes and Retain+Autorelease (From: Markus Hanauska <email@hidden>)
 >Re: Properties, Attributes and Retain+Autorelease (From: Matt Neuburg <email@hidden>)
 >Re: Properties, Attributes and Retain+Autorelease (From: Markus Hanauska <email@hidden>)

  • Prev by Date: Re: Display Letterboxing Pillarboxing
  • Next by Date: Re: problem with applying md5 to data
  • Previous by thread: Re: Properties, Attributes and Retain+Autorelease
  • Next by thread: Re: Properties, Attributes and Retain+Autorelease
  • Index(es):
    • Date
    • Thread