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 14:14:43 +0200
On Tuesday, August 6, 2002, at 01:56 Uhr, Ondra Cada wrote:
On Tuesday, August 6, 2002, at 10:34 , Marcel Weiher wrote:
Another issue to be aware of is that autorelease-pools are patented
by Apple. Therefore, their use presents a definite obstacle to
code-portability to, for example, GNUStep.
I don't know U.S. patent law well and I admit that, living outside
U.S., I am somewhat indifferent to the crap (well, if something allows
to patent things like this, it is nothing other).
Well, you shouldn't be: almost all countries nowadays have patent
agreements meaning that they recognize each other's patents. Don't
assume that you're immune from US patents just because you don't live
there.
Nevertheless it seems to me as a roaring nonsense. Autorelease pools
were invented (so far as I know, might be even sooner) by NeXT
Where do you think Apple\s patent came from? They acquired NeXT,
inclduing the patent portfolio.
and Sun when OpenStep was designed. They were part of it for a very
long time, and they were definitely part of GNUStep for *much longer
than Apple even knows they exist*!
See above.
As for other issues
Once again, I see their use in default accessors as completely
gratuitous,
and actually somewhat harmful. I also have to admit that in the
light of the Apple patent, their gratuitous introduction does have
implications that I don't like at all.
well, I understand this reasoning, but personally like more the one
Ali and I have presented (incidentally, I use autorelease-based
patterns very very happily for ten years in many hundreds of thousands
lines; never I have an accessor-based retain problem!).
Well, I do *not* use the autorelease-based pattern, have been
programming Objective-C for over 15 years (yes, before NeXT was
introduced, and obviously I have been using Foundation and
retain/release for not quite as long) and also have never seen a
problem. So I guess that is about even.
However, since the non-autorelease-based one is simpler and faster, it
wins ;-)
Nevertheless, I guess we perhaps might agree that
(a) which you call "accessors" I call "very very plain ones";
That is what an accessor is.
(b) things like -title/-setTitle: I call accessors too; you have to
invent another name for them (if needed);
Well, that depends on wether they access an instance variable (in which
case they're accessors). If they don't access an instance variables,
they're not accessors. It's sort of in the name..
(c) for them, those patterns I've presented (namely, using copy) are
very very practical;
Copying is fine as long as it isn't done in an accessor.
and, most importantly
(d) if you, in the class documentation / commented headers whether the
particular setter/getter autoreleases or not and whether it copies or
not,
there would be no harm anyway.
Well, it seems that the default should be to do nothing and not
document doing nothing. If you decide to do something, then you should
document that you're doing something ;-)
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.