Couldn't we use mixins in run-time?

Mike Parker aldacron at gmail.com
Wed Apr 21 07:59:33 UTC 2021


On Wednesday, 21 April 2021 at 07:50:35 UTC, rempas wrote:
> I'm really wondering, what stops us about using mixins in 
> run-time? I'm really interested on learning how they work. For 
> my understating, the write the code for use in compile-time and 
> then the whole things is compiled. However, I'm really 
> wondering what stops us for writing the code and compiling it 
> at run-time like it's an interpreter. Anyone that can explain 
> how things work to me?

The whole point of a mixin is to dynamically generate code at 
compile-time and insert it into your source to be compiled into 
the binary. By definition, that use case doesn't exist at 
runtime. If you had a D interpreter available at runtime, then 
you'd be evaluating D scripts, which is a completely different 
use case. And for that, you can use any scripting language to 
extend your D program.


More information about the Digitalmars-d mailing list