Remus
Rob T
rob at ucora.com
Mon Oct 29 15:24:39 PDT 2012
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
More information about the Digitalmars-d-announce
mailing list