[cfe-dev] Adding namespaces to Objective-C
Jens Ayton
mailing-lists.jens at ayton.se
Fri Nov 12 01:57:26 PST 2010
Jean-Daniel Dupas:
> Jens Ayton:
>>
>>
>> Yes. Selector conflicts are more subtle and therefore nastier than class name conflicts, and far more onerous to handle using prefixes. Given the choice, I’d much rather have namespaces for selectors than for classes.
>
> Class conflict is a real problem when you develop plugins. If two plugins developers use the same third party toolkit for example, the host application ends up trying to load each class from this toolkit 2 times, and you don't have any guarantee that they are from the same version of the toolkit.
>
> Unfortunately, I'm not sure this problem can be solved by namespaces,
Exactly. Namespaces aren’t a fix here. The old Content/SharedFrameworks/ concept might have been, to an extent.
As for the plug-in-specific classes, I always decorate the names along the lines of com_example_whatever_plugin_SomeClass, then use a macro (@compatibility_alias would be good here if it was documented) to access it as SomeClass in code. This is a minor annoyance for classes, but entirely impractical for methods since they aren’t identifiers and aren’t unique.
> Input Managers are a plague and I'm happy that Apple finally blocked them.
There are other forms of code injection, and I personally hope the platform isn’t locked up to the extent that all forms become impossible (but that’s politics). In any case, that doesn’t stop conflicts with new OS versions, new framework versions, or plug-ins.
--
Jens Ayton
More information about the cfe-dev
mailing list