Re: Accessor methods and (auto)release: conclusion
Re: Accessor methods and (auto)release: conclusion
- Subject: Re: Accessor methods and (auto)release: conclusion
- From: Marcel Weiher <email@hidden>
- Date: Tue, 6 Aug 2002 21:35:28 +0200
On Tuesday, August 6, 2002, at 08:40 Uhr, Ondra Cada wrote:
One more point which occurred in my private debate with Marcel:
Of course, you want to be somewhat cautious with methods which look
like accessors, but they do not set just object's entrails: their
raison'd'etre is to maintain some kind of *object network* instead.
Typical examples might be subviews or delegates or datasources.
Or just about anything, for that matter:
A Person object that has a "bank account". You don't want to copy that
either. Also, you probably don't want it to stick around any longer
than you specified.
If so, you won't generally use the accessor patterns, for the needs
are different! First, you would for obvious reasons never copy;
besides, sometimes (as eg. with delegates) you won't retain either,
lest you create in the network retain loops. I think such cases must
be considered individually.
Well, you do have to be careful in case of retain loops, but you just
simply do not want to generally copy *any* objects gratuitously.
Copying objects means copying object graphs in the general case, and
that is not a simple topic. So it really only works when the objects
are very simple, or are immutable and short-circuit the copy to a
retain.
Matter of factly, I would say they don't belong to this debate at all
-- had not been for the fact that at the first look, all the methods
-getter,
-superview, -delegate, -dataSource look exactly the same way, and
thus somebody just might consider using those accessor patterns for
them.
So we have more exceptions to the "general pattern"? Doesn't look all
that general to me...in fact, it looks like the pattern is actually the
exception.
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.