Closed mz2 closed 10 years ago
Yes, if these are going to be non-static they should be namespaced to avoid conflicts — MYClassFromType
and MYGetPropertyInfo
. Or they could be made into class methods of MYDynamicObject. (classFromType
definitely seems like a good candidate for that, since it already takes a Class
as a parameter, which smells like a method.)
I've now added the MY prefix and declared the functions in the MYDynamicObject header with some documentation added.
If you don't mind I'd prefer them as functions with the MY prefix because neither routine especially benefits from introducing dynamic dispatch or passing in the MYDynamicObject class (or its subclass) - as it is, the class argument in MYGetPropertyInfo could actually be any Objective-C class (indeed I also actually use these functions in an NSObject category as well as the MYDynamicObject subclass which I'll publish elsewhere).
This is so that these functions can be accessed in MYDynamicObject subclasses which need to do some more class / property reasoning. Hope this is OK? Would you prefer these function names to be made a bit more unique to avoid clashing with something unrelated?