On Mon, Dec 15, 2008 at 1:35 PM, Clark Cox <clarkc...@gmail.com> wrote:
> On Mon, Dec 15, 2008 at 7:52 AM, Benjamin Dobson
> <importedfromsp...@googlemail.com> wrote:
>> The image is already in Cocoa, named NSComputer.
>
> Don't use that name directly in your code, it's best to use the named
> constant: NSImageNameComputer.

Note that in this case, the major reason to use the constant is not
present: The constant is guaranteed to resolve to @"NSComputer", so
it's safe to use it that way. (This is done so that these images can
be used in nibs. Without guaranteed names you'd have to set them up in
code later.)

This guarantee does not apply to string constants in general, of
course! These NSImage constants are specifically guaranteed in the
docs. Other constants aren't, so if you look up what they point to and
use that string directly, you could break at any time!

Of course you're still correct that it's best to use the constant in
your code, simply because it's less typo-prone and works better with
various code editing tools. I just wanted to point out that it's not a
compatibility issue the way it is with others.

Mike
_______________________________________________

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

Reply via email to