• 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: Accessors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessors


  • Subject: Re: Accessors
  • From: Ondra Cada <email@hidden>
  • Date: Wed, 7 Aug 2002 19:26:42 +0200

On Wednesday, August 7, 2002, at 07:04 , Kevin Elliott wrote:

Also as an aside, man people have suggested that the following code

str= [thirdParty someObject];
some more code...
[str doSomething];

is inherently unsafe because the underlying value of str may be changed.
Under the "classic" getter/setter model that's not true.

that model is:
someObject: (id) object { return myObject }
setSomeObject: (id) object
{
[myObject autorelease];
[object retain];
myObject= object;
}

It become true as soon as the "some more code..." uses nested autorelease pools, and the setter happens to be inside one of them.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Accessors
      • From: Marcel Weiher <email@hidden>
References: 
 >RE: Accessors (From: Kevin Elliott <email@hidden>)

  • Prev by Date: Re: Is there a AddressBook mailing list
  • Next by Date: NSRunLoop and port
  • Previous by thread: RE: Accessors
  • Next by thread: Re: Accessors
  • Index(es):
    • Date
    • Thread