Get the code of any D-entity as string?

sighoya sighoya at gmail.com
Sat Dec 26 12:38:21 UTC 2020


On Friday, 25 December 2020 at 23:04:15 UTC, Ali Çehreli wrote:

> I am probably misunderstanding it but there is the .stringof 
> property for all types: T.stringof.

But does stringof really print the declaration as string and not 
the type name itself?

I found: https://dlang.org/spec/property.html#stringof

> I am probably stating the obvious but you normally import the 
> interesting modules of that library anyway and the type 
> information is available that way.
>
> Ali

Well, certainly, yes. But only if `stringof` would do the job. 
The best thing would be to retrieve whole modules (abstract 
files) as string. On top of that we can retrieve any value/type 
declaration.




More information about the Digitalmars-d-learn mailing list