Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Draft Proposal for Namespaces in Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Draft Proposal for Namespaces in Objective-C



On Apr 10, 2012, at 9:01 AM, Jean-Daniel Dupas wrote:

>
> They don't have to deal with dynamic message dispatching.
> Having to specify the namespace to call a method is not something usual AFAIK.

Again I must stress that my proposal tries very hard to avoid requiring specifying the namespace when invoking a selector. The compiler looks up the namespace for you, and warns if it is ambiguous. The [receiver @namespace() selector:] syntax exists as an escape hatch for compatibility, but ideally nobody would ever have to use it.

>
> This proposition look very similar to what is needed to handle multiple inheritance in C++:
> - when invoking a method, you have to specify which namespace/parent class it come from.
> - when declaring a method, you have to be able to tell if is come overwrite an existing namespace/parent class or an other, which mean we also need something like the "using" clause to import a parent method in a child class.
> - …
>
> This part will be by far the most complex aspect of the language which is actually pretty simple IMHO.

Python has multiple inheritance _and_ dynamic dispatch _and_ namespaces. Yes, it gets messy when you have to learn about the Method Resolution Order, but it's rarely an issue in practice. Likewise, if you encounter a receiver that responds to multiple compatible selectors from different namespaces, you will need to understand how to use @namespace() to resolve the conflict. But the feature is specifically designed to discourage this scenario from ever occurring.

--Kyle Sluder

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

This email sent to email@hidden


References: 
 >Draft Proposal for Namespaces in Objective-C (From: Kyle Sluder <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Kyle Sluder <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Kyle Sluder <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Jonathan Schleifer <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Kyle Sluder <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Jens Ayton <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Uli Kusterer <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Ian Joyner <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Michael Ash <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Jayson Adams <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Michael Ash <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Jean-Daniel Dupas <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.