www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D compiler equivilent of "gcc -E" for debug/view template

reply dangbinghoo <dangbinghoo gmail.com> writes:
hi, is there any D compiler option or other method to view the 
final template instantiation but not compiled (in asm or binary) 
code?

if there's a way, it might be very usefull for newbies like me to 
learn and understand the the Meta programming of dlang.



thanks!

dbh
Jul 29 2021
parent reply WebFreak001 <d.forum webfreak.org> writes:
On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote:
 hi, is there any D compiler option or other method to view the 
 final template instantiation but not compiled (in asm or 
 binary) code?

 if there's a way, it might be very usefull for newbies like me 
 to learn and understand the the Meta programming of dlang.



 thanks!

 dbh
Not sure if this is exactly what you want but there is a hidden switch in dmd called `-vcg-ast` that prints out all the templates instantiated. On run.dlang.io you can use the "AST" button to view this conveniently online.
Jul 29 2021
next sibling parent dangbinghoo <dangbinghoo gmail.com> writes:
On Friday, 30 July 2021 at 06:46:18 UTC, WebFreak001 wrote:
 On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote:

 Not sure if this is exactly what you want but there is a hidden 
 switch in dmd called `-vcg-ast` that prints out all the 
 templates instantiated.

 On run.dlang.io you can use the "AST" button to view this 
 conveniently online.
thanks a lot! this is truelly what I exactly want! it's great!
Jul 30 2021
prev sibling parent reply dangbinghoo <dangbinghoo gmail.com> writes:
On Friday, 30 July 2021 at 06:46:18 UTC, WebFreak001 wrote:
 On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote:
 Not sure if this is exactly what you want but there is a hidden 
 switch in dmd called `-vcg-ast` that prints out all the 
 templates instantiated.
but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html thanks! dbh.
Jul 30 2021
parent reply Mike Parker <aldacron gmail.com> writes:
On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:
 but, where's these switch option documented? it seems it not 
 appears in dmd --help or man dmd, or online document 
 https://dlang.org/dmd-linux.html
That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.
Jul 30 2021
next sibling parent dangbinghoo <dangbinghoo gmail.com> writes:
On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:
 On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:
 but, where's these switch option documented? it seems it not 
 appears in dmd --help or man dmd, or online document 
 https://dlang.org/dmd-linux.html
That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.
sorry, I just not noticed "hidden", thanks for all of you!
Jul 30 2021
prev sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:
 On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:
 but, where's these switch option documented? it seems it not 
 appears in dmd --help or man dmd, or online document 
 https://dlang.org/dmd-linux.html
That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.
The reason why it's not documented is because we don't want people to rely on the format of the output. I guess if we put that disclaimer in the docs we could ...
Jul 30 2021
parent dangbinghoo <dangbinghoo gmail.com> writes:
On Friday, 30 July 2021 at 10:20:36 UTC, Stefan Koch wrote:
 On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:
 On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:
 but, where's these switch option documented? it seems it not 
 appears in dmd --help or man dmd, or online document 
 https://dlang.org/dmd-linux.html
That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.
The reason why it's not documented is because we don't want people to rely on the format of the output. I guess if we put that disclaimer in the docs we could ...
ok, that is reasonable. thanks!
Jul 30 2021