Remus

Rory McGuire rjmcguire at gmail.com
Mon Oct 29 22:31:24 PDT 2012


I wonder if you could use a named public import to create something like a
namespace.
On 30 Oct 2012 00:25, "Rob T" <rob at ucora.com> wrote:

> On Tuesday, 9 October 2012 at 21:31:48 UTC, bearophile wrote:
>
>> "use" statements are converted to one or more alias' and namespaces to
>>> (mixin) templates.
>>>
>>
>> But what are they useful for?
>>
>
> 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.
>
> struct io
> {
>    static
>    {
>         void print() { writeln("foo");  }
>    }
> }
>
> io.print();
>
> 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.
>
> --rt
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20121030/ea2681ae/attachment.html>


More information about the Digitalmars-d-announce mailing list