Re: Scope variable pattern
Re: Scope variable pattern
- Subject: Re: Scope variable pattern
- From: Roy Lovejoy <email@hidden>
- Date: Fri, 11 May 2007 09:18:36 -0700
On May 11, 2007, at 8:54 AM, Erik Buck wrote:
I am a very accomplished C++ programmer with more than a decade of
experience writing and maintaining C++ code. I have to ask, why do
you want to replace two lines of code that are explicit and
intention revealing with the trick of relying on a side effect of
constructor/destructor semantics that conceals the intent of the
code ?
struct ScopedDoing {
ScopedDoing () { /* doing.. */ }
~ScopedDoing () { /* clean up.. */ }
};
almost forgot the most important..
this goes to the heart of good OOP design.. code that deals with the
object STAYS with the object.
if this structure is used 1000 places, you have ONE place where the
clean up takes place, not 1000.
one place to fix bugs, etc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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