<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yeah, I'd say the namespaces should take a form of submodules, possibly defined by subdirectories or something like that. I.e. not defined explicitly in code.<div class=""><br class=""></div><div class="">A.</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 2, 2016, at 5:15 AM, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Yes something in this space might be useful, but, and this is a significant but, we do have modules and files to break code into. So it wouldn't be a top priority.<br class=""><br class="">On Wednesday, 30 March 2016, Niels Andriesse via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="">At the moment, it's not possible to define custom namespaces. They can be emulated using <font face="monospace, monospace" class="">static</font> members on an <font face="monospace, monospace" class="">enum</font><font face="arial, helvetica, sans-serif" class="">:</font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></div><div class=""><div class=""><font face="monospace, monospace" class="">enum Foo {</font></div><div class=""><font face="monospace, monospace" class=""> static var bar: Bar</font></div><div class=""><font face="monospace, monospace" class=""> static func baz() { }</font></div><div class=""><font face="monospace, monospace" class="">}</font></div></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="arial, helvetica, sans-serif" class="">This is not ideal, because:</font></div><div class=""><ul class=""><li class=""><font face="arial, helvetica, sans-serif" class="">The case shown above is </font><font face="arial, helvetica, sans-serif" class="">semantically speaking obviously not an </font><font face="monospace, monospace" class="">enum</font><font face="arial, helvetica, sans-serif" class=""> and shouldn't be presented as such.</font></li><li class=""><font face="arial, helvetica, sans-serif" class="">The members are required to be </font><font face="monospace, monospace" class="">static</font><font face="arial, helvetica, sans-serif" class=""> unnecessarily.</font></li><li class=""><font face="arial, helvetica, sans-serif" class="">Not all top-level declarations can be nested like this (e.g. protocols).</font></li><li class=""><font face="arial, helvetica, sans-serif" class="">If we allow namespaces to be reused in different files within the same module, this could potentially be used as a custom scope for access control (e.g. using the proposed </font><font face="monospace, monospace" class="">private(...)</font><font face="arial, helvetica, sans-serif" class=""> syntax, so in this case </font><font face="monospace, monospace" class="">private(Foo)</font><font face="arial, helvetica, sans-serif" class="">).</font></li></ul><div class=""><span style="font-family:arial,helvetica,sans-serif" class="">Are there any plans to allow custom namespaces (for example as shown below)?</span></div></div><div class=""><span style="font-family:arial,helvetica,sans-serif" class=""><br class=""></span></div><div class=""><font face="monospace, monospace" class="">namespace Foo {</font></div><div class=""><font face="monospace, monospace" class=""> var bar: Bar</font></div><div class=""><font face="monospace, monospace" class=""> func baz() { }</font></div><div class=""><font face="monospace, monospace" class="">}</font></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="arial, helvetica, sans-serif" class="">Alternatively, a similar situation could be achieved by introducing submodules.</font></div></div>
</blockquote><br class=""><br class="">-- <br class="">-- Howard.<br class="">
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>