Pseudo namespaces
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Thu Dec 3 16:43:05 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
Walter doesn't like it but there's always this option as well.
IMO it's the cleanest way:
extern(C++, stable.linear)
{
extern(D):
enum sort = 0;
}
extern(C++, linear.stable)
{
extern(D):
alias sort = .stable.linear.sort;
}
void main()
{
assert(stable.linear.sort == 0);
assert(linear.stable.sort == 0);
}
More information about the Digitalmars-d
mailing list