Re: GC pros and cons
Re: GC pros and cons
- Subject: Re: GC pros and cons
- From: Quincey Morris <email@hidden>
- Date: Wed, 24 Jun 2009 10:51:50 -0700
On Jun 24, 2009, at 09:14, Philip Aker wrote:
Like Gwynne, I'm comfortable with the traditional "reap what you
sow" philosophy. This has benefits in that the basic policy spills
over into other areas of programming and gradually, one learns as a
matter of habit, to account for things all the time. This is good
but can be lumped in with many other things learned from the school
of hard knocks. With GC, the attitude is like one could fire a
shotgun into a crowd and the walk away because the system will take
responsibility for the consequences. Maybe you could say that's a
moral issue. But it's certainly not something children should be
taught in school.
I think we all have (pragmatically) a pretty good idea of where the
morality of not killing and maiming people comes from. But where does
the morality of explicitly releasing objects come from? Traditionally,
releasing objects properly is *necessary*, and perhaps it is moral to
bow to necessity. But reversing the argument -- arguing from the
morality to the necessity, as you have done -- doesn't work.
In a nutshell, for folks like me who regularly use CFCreate …
CFRelease in loops, what are the benefits of GC?
If CFCreate/CFRelease is precisely what you want to do, there are no
benefits from GC, because the garbage collector isn't involved.
Similarly, if you regularly use alloc/init ... release in loops, there
are no benefits from using autorelease instead of release (in a non-GC
app, I mean).
However, if the lifetime of the object you CFCreate is not strictly
internal to the loop, then using (in a GC app) CFMakeCollectable once
instead of futzing with CFRelease in multiple paths of execution might
simplify your code greatly.
_______________________________________________
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