Templated aliases name in compilation error output

Jonathan M Davis jmdavisProg at gmx.com
Sat Feb 11 21:17:52 PST 2012


On Saturday, February 11, 2012 23:59:39 bearophile wrote:
> Jonathan M Davis:
> > aliases are always replaced with the original and you never see the
> > aliased
> > name in the compiler output. It's only for the source. Now, that's not
> > entirely a good thing. I'd actually prefer that the alias name were used
> > if
> > the variable in question was declared with the alias name rather than the
> > original, but that's just not how it works at this point.
> 
> Vote for this president :-)
> http://d.puremagic.com/issues/show_bug.cgi?id=5004

Error messages aren't the only thing. It goes well beyond that. This program

import std.stdio;

void main()
{
    alias int I;
    writeln(I.stringof);
    I hello;
    writeln(typeof(hello).stringof);
}

prints

int
int

aliases don't really exist as far as the compiler is concerned. It just 
replaces them with the original and that's the end of it. A lot more than 
error messages would need to change for aliases to be handled differently.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list