Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespaces and ObjC




On Aug 23, 2005, at 3:04 AM, ObjM2 wrote:


Hi

we intend to introduce namespaces to ObjM2 and ideally do so in a way that ObjC classes will also benefit from this. It would be great if somebody with insights into the Mach-O format and the ObjC runtime could give some feedback or even join our discussion on this topic.

So far the idea is to allow classes to be bundled into a library module and add a facility for the library module to rename the classes as it exports them, which would cause them to be added to the ObjC runtime under their "rebranded" name instead of their original name.

[snip example]
It would seem that this should be possible to do, but we are not sure about that. We'd appreciate some comments on this, mainly as to feasibility in general, not necessarily in respect of how to do it, because at this point the goal is to design a language extension. Implementation is further down the road.

thanks for any feedback
ObjM2 project

So how would NSClassFromString handle having the classes being renamed? You could, in theory, find the static strings and change them (ugh), but anything which uses a string constructed on the fly would fail (since the constructed name no longer matches).


And this approach seems to have the insidious side effect that the original code (that which existed before being rebranded) has no way to know that this is happening (since there is that module that takes the original classes and then actually does the rebranding).

Personally, I'd investigate a C++ style namespace (which would be built on a prefixing scheme, rather than renaming, so NSClassFromString could be modified to know the 'current' classname).


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden
References: 
 >Namespaces and ObjC (From: ObjM2 <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.