help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alloc/dealloc etiquette


From: David Phillip Oster
Subject: Re: Alloc/dealloc etiquette
Date: Sat, 17 Feb 2007 20:00:10 GMT
User-agent: MT-NewsWatcher/3.4 (PPC Mac OS X)

In article <oster-C482BB.11543417022007@newsclstr02.news.prodigy.com>,
 David Phillip Oster <oster@ieee.org> wrote:

> In article <m2vei1wc52.fsf@local.wv-www.com>,
>  Sherm Pendley <spamtrap@dot-app.org> wrote:
> 
> >     - (void)setFoo:(NSObject *)value {
> >         if (foo != value) {
> >             [foo release];
> >             foo = [value copy];
> >         }
> >     }

Apologies. I was assuming a matching:

- (NSObject *)foo{
  return foo;
}

But, if you always write:

- (NSObject *)foo{
  return [[foo copy] autorelease];
}

then my "swap" criticism doesn't apply. However, I often want access to 
an object's part, not a transient copy of the part. (When I pull a 
puppet's string, connected to its finger, I expect the finger to move, 
not a copy of the finger, which is then immediately thrown away.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]