core.reflect becomes recursive

max haughton maxhaton at gmail.com
Mon Aug 9 17:42:46 UTC 2021


On Monday, 9 August 2021 at 16:38:25 UTC, Tejas wrote:
> On Sunday, 8 August 2021 at 18:50:31 UTC, Stefan Koch wrote:
>> Good Afternoon everyone,
>>
>> Just now I've added a nice tool to the core_reflect druntime 
>> branch.
>> The transitive visitor.
>>
>> [...]
>
> Hello,
>
> How does this compare to DMD as a library?
>
>
> https://dlang.org/blog/2017/08/01/a-dub-case-study-compiling-dmd-as-a-library/
>
>
> Lower barrier to entry?
> More functionality?

Very different concepts.

This work is about introspection over D code, specifically at 
compile time. Specifically, providing a sane and *complete* 
interface that actually matches the form of the thing being 
introspected over (recall that `__traits` is linear whereas an 
AST is a tree). The data structures Stefan is introducing could 
theoretically be used as a clean interface to D code (a la 
`libdparse` but in sync with the compiler and more specifically 
the semantic analysis), i.e. not at compile time.

dmd-as-a-library is just drinking from the firehose, you get the 
full AST, warts and all - or at least you *can* (You have the 
option to use `ASTBase`). You can't run dmd as a library at 
compile time to parse D code, unfortunately (I tried...).


More information about the Digitalmars-d mailing list