Objective C: I really miss namespaces

2008/09/02

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