www.digitalmars.com         C & C++   DMDScript  

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

reply Pedro Lacerda <pslacerda gmail.com> writes:
--00151761ca76ddd7a704b8bc4aba
Content-Type: text/plain; charset=UTF-8

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 --00151761ca76ddd7a704b8bc4aba Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi all,<div><br></div><div>When aliases are used I expect to see it names o= n compile errors. But when I use:</div><div><blockquote class=3D"gmail_quot= e" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0= .8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-s= tyle:solid;padding-left:1ex"> <font face=3D"&#39;courier new&#39;, monospace">struct __Bulk(T) {<br>=C2= =A0 =C2=A0 T[] chunks;<br>}<br>alias __Bulk!(byte) Bulk;<br>alias __Bulk!Bu= lk =C2=A0 MultiBulk;</font></blockquote></div><div><div><br></div><div>The = compilation error for:</div> <div><blockquote class=3D"gmail_quote" style=3D"margin-top:0px;margin-right= :0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-= color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face= =3D"&#39;courier new&#39;, monospace">void question1() {<br> =C2=A0 =C2=A0 Bulk(&quot;bad&quot;);<br>}</font></blockquote></div><div><br=
</div><div>is:</div><div><blockquote class=3D"gmail_quote" style=3D"margin=

idth:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding= -left:1ex"> <font face=3D"&#39;courier new&#39;, monospace">bla.d(12): Error: cannot im= plicitly convert expression (&quot;bad&quot;) of type string to byte[]<br>b= la.d(12): Error: structliteral has no effect in expression (__Bulk((__error= )))</font></blockquote> </div><div><br></div><div>I expected to see <font face=3D"&#39;courier new&= #39;, monospace">(Bulk((__error)))</font>=C2=A0instead of=C2=A0<font face= =3D"&#39;courier new&#39;, monospace">(__Bulk((__error)))</font>.</div><div=
<br></div>

And the runtime output error for:</div><div><blockquote class=3D"gmail_quot= e" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0= .8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-s= tyle:solid;padding-left:1ex"> <font face=3D"&#39;courier new&#39;, monospace">void question2() {<br>=C2= =A0 =C2=A0 MultiBulk mb;<br>=C2=A0 =C2=A0 writeln(typeid(mb));<br>}</font><= /blockquote></div><div><br></div><div>is:</div><blockquote class=3D"gmail_q= uote" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-lef= t:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-lef= t-style:solid;padding-left:1ex"> <font face=3D"&#39;courier new&#39;, monospace">bla.__Bulk!(__Bulk!(byte)).= __Bulk</font></blockquote><div><br></div><div>Despite in runtime I accept d= on&#39;t see aliases name, if it is needed for accomplish speed.</div><div> <br></div><div>What are your opinions about these erros output?</div><div><= br></div><div>Pedro Lacerda</div><br> </div> --00151761ca76ddd7a704b8bc4aba--
Feb 11 2012
next sibling parent Trass3r <un known.com> writes:
dmd simply doesn't keep those information about aliases.
Feb 12 2012
prev sibling 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 next sibling parent Pedro Lacerda <pslacerda gmail.com> writes:
--000e0ce0391e8e75a304b8df9995
Content-Type: text/plain; charset=UTF-8

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

--000e0ce0391e8e75a304b8df9995 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Would be bad or hard dmd keep those information, and outputs like gcc &quot= ;aka&quot;?<br clear=3D"all"><div><br></div>Pedro Lacerda<br><br> <br><br><div class=3D"gmail_quote">2012/2/12 Jonathan M Davis <span dir=3D"= ltr">&lt;<a href=3D"mailto:jmdavisProg gmx.com">jmdavisProg gmx.com</a>&gt;= </span><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor= der-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im">On Sunday, February 12, 2012 13:00:16 Trass3r wrote:<br> &gt; dmd simply doesn&#39;t keep those information about aliases.<br> <br> </div>Exactly.<br> <span class=3D"HOEnZb"><font color=3D"#888888"><br> - Jonathan M Davis<br> </font></span></blockquote></div><br> --000e0ce0391e8e75a304b8df9995--
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