Maybe another way to do compile time rewrites

aaaaa via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 21:34:48 PDT 2014


Currently what happens is you do

dmd program1.d

and program1.d uses mixin and compile time reflections to 
internally rewrite itself to be effectively program2.d so

dmd program1.d

and

dmd program2.d

are the same.

However another possible way might be

rdmd program3.d > program2.d
dmd program2.d

That is, program3.d would (at runtime) generate program2.d which 
you can then compile. This has the advantage of being possibly 
faster and simpler, because you don't have to do everything at 
compile time. Recent talks have lamented at the limited tools 
available for compile time debugging and if you generate the code 
at runtime, you have access to all the runtime facilities for 
debugging code. This also removes the restriction of not being 
able to do system calls during compile time because you can do 
whatever you want during the runtime of program3.d

I have no idea how much more complex this would be and am just 
thinking out loud. Anyway, thanks everyone for developing and 
maintaining D!


More information about the Digitalmars-d mailing list