On 9/21/14, ketmar via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > On Sun, 21 Sep 2014 08:15:29 -0700 > Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com> > wrote: > >> alias Int1 = Typedef!(int, "a.Int1"); >> alias Int2 = Typedef!(int, "b.Int2"); > ah, now that's cool. module system? wut? screw it, we have time-proven > manual prefixing!
To be fair we now have __MODULE__. Although it does make the call side a bit ugly. But then again, nothing is stopping anyone from writing a helper template around Typedef that hides all this ugliness, e.g.: ----- // helper alias alias StrongAlias(T, string mod = __MODULE__, size_t line = __LINE__) = Typedef!(T, T.init, format("%s.%s.%s", mod, line, T.stringof)); // usage: alias Int1 = StrongAlias!int; alias Int2 = StrongAlias!int; static assert(!is(Int1 == Int2)); ----- This works for me locally. We could add __COLUMN__ to be extra-safe of course, by then it should be a solved problem.