[cfe-dev] Adding namespaces to Objective-C

Ariel V Feinerman arielfeinerman at gmail.com
Fri Nov 12 10:55:53 PST 2010


Jens,

do you mean?

@interface MyClass : NSObject {

}
@namespace ns
- method;
@end

@namespace my
- method;
@end

// global
@namespace
- method;
@end


On Fri, Nov 12, 2010 at 3:12 AM, Jens Ayton <mailing-lists.jens at ayton.se>wrote:

> On Nov 9, 2010, at 22:54, Owen Shepherd wrote:
> >
> >
> > The hardest aspect seems to be namespacing of selectors; it seems to be
> an issue which I haven't really seen affecting other languages, and seems a
> rather difficult one to solve elegantly, though I must ask: Is it a major
> issue in practice? I haven't found it to be, and haven't found other people
> claiming it to be either, though I don't claim that it doesn't exist.
>
> 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.
>
> (An advantage of only namespacing selectors is that you could use the most
> elegant namespace separator I’ve come across: a space. [object namespace
> method] is unambiguous, as long as you don’t also allow [namespace Class
> method]. I don’t expect this idea to win the day, though.)
>
> As a practical example of a selector conflict, I once had an app crash on
> one user’s machine because it had a convenience method -[NSDictionary
> setDouble:forKey:], and an input manager hack defined a -setDouble:forKey:
> with conflicting semantics. I’ve heard of people being bitten by conflicts
> with methods introduced in superclasses in system updates, too.
>
>
> On Nov 10, 2010, at 00:50, Owen Shepherd wrote:
> >
> >
> > Namespaces are a property of types, of which objects are just one form
>
> Namespaces are a property of names, of which types are just one form.
>
>
> On Nov 11, 2010, at 19:41, jahanian wrote:
> >
> > 1. Somehow c has survived 30+ years not needing namespaces. I am told
> that it is not on the table yet.
>
> C (per se) doesn’t have dynamic name lookups.
>
>
> --
> Jens Ayton
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



-- 
best regards
Ariel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101112/06b44c62/attachment.html>


More information about the cfe-dev mailing list