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

About these ads

One Response to Objective C: I really miss namespaces

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: