David Phillip Oster <[EMAIL PROTECTED]> writes:

> In article <[EMAIL PROTECTED]>,
>  David Phillip Oster <[EMAIL PROTECTED]> wrote:
>
>> In article <[EMAIL PROTECTED]>,
>>  Sherm Pendley <[EMAIL PROTECTED]> 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.

The example setter I posted was generated by Xcode, and it does indeed
generate a getter to match, although using -retain rather than -copy.
I should have posted both generated methods to avoid the confusion.

Sorry!

> 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.)

Yeah, I'm a little skeptical of Apple's setters doing a -copy by default
also. It seems to run counter to the whole idea of shared ownership that
retain/release was designed to support in the first place.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Help-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnustep

Reply via email to