Pseudo namespaces

FreeSlave via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 3 13:05:06 PST 2015


On Thursday, 3 December 2015 at 20:51:02 UTC, Andrei Alexandrescu 
wrote:
> I vaguely remembered I saw something like this a while ago:
>
> http://dpaste.dzfl.pl/f11894a098c6
>
> The trick could be more fluent, but it might have merit. Has 
> anyone explored it? Is it a viable candidate for becoming a D 
> idiom?
>
> I was looking at this in conjunction with choosing a naming 
> convention for container functions. Some functions are "stable" 
> so that would be part of their name, e.g. insertStable or 
> stableInsert. With this, it's possible to write 
> lst.stable.insert.
>
>
> Andrei

I don't understand how it is namespace (it's just named scope for 
me) and why do we need template for that? Probably struct with 
static members would work the same without need for instantiating 
the template.

When talking about namespaces in the C++ sense, the feature of 
namespace is that it can be scattered among many files and can be 
'using'.



More information about the Digitalmars-d mailing list