On May 29, 2013, at 10:37 AM, Alex Zavatone <z...@mac.com> wrote:

> I'm aware that certain prefixes like "set" are bad news to use to start 
> method names for obvious reasons, but with the caffeine levels in my brain 
> cell running low, I'm at a loss to recall some of the others (is return 
> verboten?).  Is there a list of reserved method prefix strings that you 
> simply shouldn't use to start your methods?

There aren’t any forbidden prefixes that I know of, but there are ones that 
should be used only for particular purposes, because the compiler and/or 
runtime will make assumptions about them when they see that prefix.

It’s fine to have a method -setFoo:, it’s just that it will be interpreted as a 
setter for a property “foo”. Which is usually what you meant anyway.

ARC makes assumptions about special refcounting behavior of methods named 
“copy” or “mutableCopy” or that start with “init” or “alloc” or “new” — all of 
these are assumed to return an object reference that needs to be released by 
the caller. There might be others but those are all I can remember; the ARC 
docs may have a complete list.

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

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

Reply via email to