"temporary" templates

Paul Backus snarwin at gmail.com
Wed Nov 27 16:19:05 UTC 2019

On Wednesday, 27 November 2019 at 08:45:55 UTC, FeepingCreature 
> On Tuesday, 26 November 2019 at 18:59:26 UTC, Paul Backus wrote:
>> This will cause compilation to become non-deterministic, since 
>> the result of template evaluation can depend on the order in 
>> which declarations are semantically analyzed:
> ...
> Snapshot the lexical environment at the point of instantiation? 
> Could make namespaces linked list of arrays so you can 
> copy-on-write them for relatively cheap. Compilation is pure 
> enough that this should be sufficient.

The lexical environment is not enough. Due to the power of D's 
reflection, the result of template instantiation depends, in the 
worst case, on the state of the entire AST at time of 

Using an immutable AST with copy-on-write semantics would 
probably work.

More information about the Digitalmars-d mailing list