www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Templated aliases name in compilation error output

reply Pedro Lacerda <pslacerda gmail.com> writes:
Hi all,

When aliases are used I expect to see it names on compile errors. But when
I use:

 struct __Bulk(T) {
     T[] chunks;
 }
 alias __Bulk!(byte) Bulk;
 alias __Bulk!Bulk   MultiBulk;

The compilation error for:
 void question1() {
     Bulk("bad");
 }

is:
 bla.d(12): Error: cannot implicitly convert expression ("bad") of type
 string to byte[]
 bla.d(12): Error: structliteral has no effect in expression
 (__Bulk((__error)))

I expected to see (Bulk((__error))) instead of (__Bulk((__error))). And the runtime output error for:
 void question2() {
     MultiBulk mb;
     writeln(typeid(mb));
 }

is:
 bla.__Bulk!(__Bulk!(byte)).__Bulk

Despite in runtime I accept don't see aliases name, if it is needed for accomplish speed. What are your opinions about these erros output? Pedro Lacerda
Feb 11 2012
next sibling parent reply Trass3r <un known.com> writes:
dmd simply doesn't keep those information about aliases.
Feb 12 2012
next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, February 12, 2012 13:00:16 Trass3r wrote:
 dmd simply doesn't keep those information about aliases.

Exactly. - Jonathan M Davis
Feb 12 2012
prev sibling parent Pedro Lacerda <pslacerda gmail.com> writes:
Would be bad or hard dmd keep those information, and outputs like gcc "aka"?

Pedro Lacerda



2012/2/12 Jonathan M Davis <jmdavisProg gmx.com>

 On Sunday, February 12, 2012 13:00:16 Trass3r wrote:
 dmd simply doesn't keep those information about aliases.

Exactly. - Jonathan M Davis

Feb 13 2012
prev sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Monday, February 13, 2012 19:59:40 Pedro Lacerda wrote:
 Would be bad or hard dmd keep those information, and outputs like gcc "aka"?

It should be quite possible, but I have no idea how hard it would be. Regardless, it's not the kind of change I'd expect anytime soon, because the benefits are relatively minor in comparison to fixing bugs. The source is open on github for anyone to hack at and submit pull requests if they want to though. - Jonathan M Davis
Feb 13 2012