Get the code of any D-entity as string?

Basile B. b2.temp at gmx.com
Sun Dec 27 14:40:01 UTC 2020


On Sunday, 27 December 2020 at 12:20:01 UTC, sighoya wrote:
> On Sunday, 27 December 2020 at 04:13:53 UTC, Max Haughton wrote:
>> Not possible although implementing as a __trait would be about 
>> 15 lines I think.
>>
>
> I think that too, and it would nicely reuse the work of the 
> compiler to parse the whole project.
>
>> I think read only AST access in some form would actually be 
>> quite nice, if not for dmd's AST being fuckugly (the hierarchy 
>> is fine but it's more gcc than clang)
>
> The point is, once we have that we can decide ourselves which 
> framework is the best for meta modelling.
>
> Is it pure string manipulation or token stream manipulation à 
> la Rust or an AST manipulation à la Nim/Scala. It can be all 
> defined on top.

A more concrete example of what you are trying to achieve would 
allow to show the D way.


More information about the Digitalmars-d-learn mailing list