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 13 Apr 2012, at 00:18, Kyle Sluder wrote:

> On Apr 12, 2012, at 4:05 AM, Ian Joyner <email@hidden> wrote:
>
>> Part of my unease is that the disambiguation in other languages I have seen (like Java) occurs in the code all over the place, particularly with com.mikeash.Array. Really, the dots (.), might look like some kind of multi-level name, but in actual fact are just part of a longer name.
>>
>> A single point of decision would be much cleaner, like a single piece of meta syntax saying
>>
>> use array from com.mikeash
>>
>> or with renaming
>>
>> use array from com.mikeash as maarray
>
> This is covered in my proposal by using namespace scopes. You add "@using com.mikeash" to the top of the file and now naked references to Array resolve to com.mikeash.Array. Or to avoid clashes you use "@using com.mikeash = ma" and now you can use ma.Array.

Interesting. Thanks for all your work and leading a very reasoned discussion Kyle.

I wonder if @using is a little like the oft-criticized with statement of Pascal and JavaScript though. I'm not sure whether I believe that since @using seems a lot more coarse-grained whereas with can be used to reference different entities in a small area - although the combination of them makes it confusing. Plus I think the fact that withs can make variables of the same name hidden and ambiguous. So maybe I have no need for concern.

I think one important principle to address is Parnas's Information Hiding. (A lot of C++ people just believe that is hiding variables behind get and set routines, but in fact it is more about implementation details of a module not leaking over to others). Do namespaces keep modules really independent or introduce coupling and dependencies between modules? I ask that because I really don't know the answer.

A final point. Maybe we think of modules too much in terms of dividing programs into files. I find files an artificial concept that constrains our thinking. In fact modules really are much higher-level more abstract in nature. I know a lot of languages equate module with file, but I think we need to decouple this.

I say this because I still think that the information carried in the @using directive could somehow be external to a module and thus a file.

Sorry, I'm not trying to be difficult, just throw in a few ideas to think about.

Thanks for the discussion.
Ian
 _______________________________________________
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: Ian Joyner <email@hidden>)
 >Re: Draft Proposal for Namespaces in Objective-C (From: Kyle Sluder <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.