Thread overview
Re: Templated aliases name in compilation error output
Feb 12, 2012
Jonathan M Davis
Feb 12, 2012
bearophile
Feb 12, 2012
Jonathan M Davis
February 12, 2012
> On Sunday, February 12, 2012 01:52:16 Pedro Lacerda wrote: What are your opinions about these erros output?

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.

- Jonathan M Davis
February 12, 2012
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

Bye,
bearophile
February 12, 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