<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="font-family: 'helvetica Neue', helvetica;">I personally dislike the habit of deliberately naming different classes using the same name within a single project/module/library, just using different namespaces - one should be able to deduct from the code *which* class is being used without excessive checking.</div><div class="" style="font-family: 'helvetica Neue', helvetica;"><br class=""></div><div class="" style="font-family: 'helvetica Neue', helvetica;">When you have namespaces Car and Animal and each contains a class called List, IMHO there should be classes CarList and AnimalList. It's more verbose, but you imediately know which class is being used in opposite of just using List.</div></blockquote></div><p>I assume you would still stick around with a standalone `SomeCustomeViewDelegate` protocol rather than use `SomeCustomView.Delegate` and nest the `Delegate` protocol inside `SomeCustomView`? This isn’t an example about namespaces but you get the idea.</p><p>What looks better to you?</p><p>protocol SomeCustomeViewDelegate {…}</p><p>or</p><p>extension SomeCustomView {</p><p>&nbsp; &nbsp; &nbsp;protocol Delegate {…}</p><p>}</p><div><div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="font-family: 'helvetica Neue', helvetica;">I don't have much experience with C++ and C#, but sometimes I have to dive into C# code and you can hear my teeth grind since there is a declaration of a variable of class List and you have no idea which List is this, since there are dozens of classes with this name. You don't always have the code in an IDE to resolve the symbol for you, sometimes you browse it on git, etc.</div><div class="" style="font-family: 'helvetica Neue', helvetica;"><br class=""></div><div class="" style="font-family: 'helvetica Neue', helvetica;">Which is why I personally find modules sufficient in providing a way to prevent naming collisions, yet strict enough to discourage the habits of other languages described above.</div></blockquote></div><p>In my eyes namespaces in Swift (if we get them) should be optional which will allow someone write clear code if there is any desire.</p><p>For my project I’m working on it’s something like:</p><p>Reference.Buffer</p><p>Reference.String</p><p>Where I’m working with Pointers inside.</p><div>If I will use a module for this in my project, there will be a name collision with String when I forget about `Reference.`.</div></div><div><br></div><div>One can already achieve a pseudo namespaces by abusing structs for example.</div><div><br></div><div>struct Namespace {</div><div>&nbsp; &nbsp; &nbsp;private init() {}</div><div>}</div><div><br></div><div>But you still can something like:</div><div><br></div><div>extension Namespace { … }</div><div><br></div><div>This doesn’t fell right.</div></div> <div><br></div>Downside of modules in a huge project is that you might need re-build modules all over again when you changes something. :/<br> <div id="bloop_sign_1463752833042923008" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Adrian Zubarev<br>Sent with Airmail</div></div></body></html>