Beyond the veil: What's after type functions

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Jan 7 14:05:27 UTC 2021


On Thursday, 7 January 2021 at 10:39:02 UTC, Jacob Carlborg wrote:
> On 2021-01-06 20:36, Ola Fosheim Grøstad wrote:
>
>> Ok, but it would have to map exactly since it would be 
>> modified after a succession of template evaluations? Or maybe 
>> not.
>
> I'm not sure if I follow. But the compiler will convert between 
> the internal AST and external AST on macro boundaries, i.e. 
> when something is passed to a macro and when something is 
> returned.

But you are able to traverse the whole external AST tree?

So you maintain what is equivalent of a virtual AST? Kinda like 
React does with a virtual DOM?

That's ok if only the virtual AST changes, then you can propagate 
changes to the real AST. UNLESS the compiler is caching 
information in other structures... At that point things get 
really hairy.

But how to detect changes in the real AST, if the compiler 
modifies it?

You need to add a tracking mechanism, dirty-marking or some such.





More information about the Digitalmars-d mailing list