Re: question about "read-only" rule for Memory Management

2010-04-26 Thread Philip Mobley
On Apr 26, 2010, at 10:50 PM, Ken Thomases wrote:

>> No. The "get" prefix is used for return-via-pointer. For example,
>> -[NSString getCharacters:range].
> 
> As documented here 
> .
> 
> Cheers,
> Ken

I see... thank you everyone!

The key phrase here is in the link provided by Ken Thomases (I was looking for 
this before I asked question):

developer.apple.com/.../NamingMethods.html:
> Use “get” only for methods that return objects and values indirectly. You 
> should use this form for methods only when *multiple* items need to be 
> returned.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: question about "read-only" rule for Memory Management

2010-04-26 Thread Ken Thomases
On Apr 26, 2010, at 11:39 PM, Kyle Sluder wrote:

> On Mon, Apr 26, 2010 at 6:57 PM, Philip Mobley  wrote:
>> Question:  is the BELOW method named appropriately?
>> 
>> - (UIImage *) getImageWithTag:(NSString *)tag;
> 
> No. The "get" prefix is used for return-via-pointer. For example,
> -[NSString getCharacters:range].

As documented here 
.

Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: question about "read-only" rule for Memory Management

2010-04-26 Thread Kyle Sluder
On Mon, Apr 26, 2010 at 6:57 PM, Philip Mobley  wrote:
> Question:  is the BELOW method named appropriately?
>
> - (UIImage *) getImageWithTag:(NSString *)tag;

No. The "get" prefix is used for return-via-pointer. For example,
-[NSString getCharacters:range].

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: question about "read-only" rule for Memory Management

2010-04-26 Thread Jens Alfke

On Apr 26, 2010, at 6:57 PM, Philip Mobley wrote:

> Question:  is the BELOW method named appropriately?
> 
> - (UIImage *) getImageWithTag:(NSString *)tag;

Usually Cocoa method names drop the “get” prefix, so ideally the name would 
just be “imageWithTag:”.

But yes, there’s no need to say “copy” since you’re not creating copies of the 
images. (And even if you were, you could just autorelease them before returning 
them, so the caller wouldn’t have to worry about releasing them; so you 
wouldn’t need to call it out in the method name.)

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


question about "read-only" rule for Memory Management

2010-04-26 Thread Philip Mobley
Assume that an array of images is loaded at the start of the app.  

There are a number of views which will be displaying multiple "copies" of the 
image, but they will be accessing the image array as a read-only property, and 
I do not plan to have these views adjust the reference count for each image.  

Question:  is the BELOW method named appropriately?

- (UIImage *) getImageWithTag:(NSString *)tag;

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com