<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 11 Nov 2010, at 13:37, Ariel V Feinerman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Everyone strongly discourages the use "using namespace" since the objects from tens used namespaces can clashes, well then to make short namespace names we can use aliases, but would they clash like prefixes?  <div>

<br></div></blockquote><div><br></div><div>Indeed, though there are other useful uses of it (e.g. before C++0x's "inline namespaces" support, I have used it in order to give binary incompatible versions of a library different symbols). It is also perfectly acceptable for the library implementer to do</div><br><blockquote type="cite"><div><div><div><br><div class="gmail_quote">On Wed, Nov 10, 2010 at 9:52 PM, Owen Shepherd <span dir="ltr"><<a href="mailto:owen.shepherd@e43.eu">owen.shepherd@e43.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On 10 Nov 2010, at 19:23, Ariel V Feinerman wrote:<br>
<br>
</div><div class="im">> I think prefixes are more beautiful than namespaces (by the way they are simple for runtime support ;-). There is no diversity between NSSet or NS::Set, excepting one or more unnecessary letters, so why? The namespaces do not increase the culture, then if prefixes can conflict so namespaces can likewise.<br>


<br>
</div>Objective-C at present doesn't give you a choice. Your namespace must be short, or else be very cumbersome to use. Hence, everyone uses 2 character prefixes (or 3 at most), which are prone to clashes.<br>
<br>
On the other hand, if namespaces were supported, it is likely that NSObject would be called something along the lines of Foundation::Object, and other libraries would also use longer namespace names. This would not make programs any longer due to features such as "using namespace" and/or namespace aliases (e.g. something along the lines of C++0x's "using NS = Foundation", or even "using F = Foundation") and the ability to import entities from one namespace into another (e.g. "using Foundation::Object").<br>


<br></blockquote><div>My and your code will be incompatible if we choose NS, N, or something instead of Foundation:: We increase issues and look how we can  eliminate them.</div></div></div></div></div></blockquote><div><br></div><div>Lets say I make a library "MyLib", and you make the library "YourLib". If I do</div><div>MyLib.h:</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>namespace MyLib {</div><div><span class="Apple-tab-span" style="white-space:pre">            </span>using F = Foundation;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">               </span>@interface MyClass : F::Object {</div><div><span class="Apple-tab-span" style="white-space:pre">             </span>};</div><div><span class="Apple-tab-span" style="white-space:pre">           </span>@end</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><br></div><div>MyLib.m:</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>using namespace MyLib;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">      </span>@implementation MyClass</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>...</div><div><br></div><div>then we have no danger of collision. </div><blockquote type="cite"><div><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div></div></blockquote></div></div></div></div></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">-- Owen Shepherd<br><a href="http://www.owenshepherd.net/">http://www.owenshepherd.net/</a><br>owen.shepherd@e43.eu (general) / oshepherd1@shef.ac.uk (university)<br></span>
</div>
<br></body></html>