Re: Accessors
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.