<p dir="ltr">I wonder if you could use a named public import to create something like a namespace.</p>
<div class="gmail_quote">On 30 Oct 2012 00:25, "Rob T" <<a href="mailto:rob@ucora.com">rob@ucora.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Tuesday, 9 October 2012 at 21:31:48 UTC, bearophile wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
"use" statements are converted to one or more alias' and namespaces to (mixin) templates.<br>
</blockquote>
<br>
But what are they useful for?<br>
</blockquote>
<br>
Namespaces can be useful for organizational reasons. For example they can be used for grouping a collection of items under one roof. However you can already accomplish this and more using struct along with static members.<br>
<br>
struct io<br>
{<br>
static<br>
{<br>
void print() { writeln("foo"); }<br>
}<br>
}<br>
<br>
io.print();<br>
<br>
Plus struct's come with additional abilities that can turn a simple namespace into a much more capable one, for example by adding in ctors and dtors.<br>
<br>
--rt<br>
<br>
</blockquote></div>