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><br>On Wednesday, 30 March 2016, Niels Andriesse via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>At the moment, it's not possible to define custom namespaces. They can be emulated using <font face="monospace, monospace">static</font> members on an <font face="monospace, monospace">enum</font><font face="arial, helvetica, sans-serif">:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div><font face="monospace, monospace">enum Foo {</font></div><div><font face="monospace, monospace"> static var bar: Bar</font></div><div><font face="monospace, monospace"> static func baz() { }</font></div><div><font face="monospace, monospace">}</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">This is not ideal, because:</font></div><div><ul><li><font face="arial, helvetica, sans-serif">The case shown above is </font><font face="arial, helvetica, sans-serif">semantically speaking obviously not an </font><font face="monospace, monospace">enum</font><font face="arial, helvetica, sans-serif"> and shouldn't be presented as such.</font></li><li><font face="arial, helvetica, sans-serif">The members are required to be </font><font face="monospace, monospace">static</font><font face="arial, helvetica, sans-serif"> unnecessarily.</font></li><li><font face="arial, helvetica, sans-serif">Not all top-level declarations can be nested like this (e.g. protocols).</font></li><li><font face="arial, helvetica, sans-serif">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">private(...)</font><font face="arial, helvetica, sans-serif"> syntax, so in this case </font><font face="monospace, monospace">private(Foo)</font><font face="arial, helvetica, sans-serif">).</font></li></ul><div><span style="font-family:arial,helvetica,sans-serif">Are there any plans to allow custom namespaces (for example as shown below)?</span></div></div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><font face="monospace, monospace">namespace Foo {</font></div><div><font face="monospace, monospace"> var bar: Bar</font></div><div><font face="monospace, monospace"> func baz() { }</font></div><div><font face="monospace, monospace">}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Alternatively, a similar situation could be achieved by introducing submodules.</font></div></div>
</blockquote><br><br>-- <br>-- Howard.<br>