Objective C: I really miss namespaces

One feature that I strongly miss from Objective C are namespaces. Inability to avoid name clash between your  classes sometimes really stands in your way.

I am reading S. Kochan’s book “Programming in Objective C” and in one of the examples he creates the class Point. Unfortunately, there already is struct Point defined in mactypes.h.

The solution is easy – rename the darn Point to something like TKPoint … at least that is what Cocoa naming guide recommends. It is probably matter of getting used to it  – but I still find the solution suggested by Kevin Hoffman much more elegant – too bad it is only theoretical. Much nicer than NSHack 😉

Advertisements
Explore posts in the same categories: Apple, Mac, programming

Tags:

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: