Maybe another way to do compile time rewrites

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 21 18:38:17 PDT 2014


On 6/21/14, 1:34 AM, aaaaa wrote:
> 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!

It's not complex at all, and it's a great idea (and it seems more and 
more people are concluding what you just concluded). See this:

http://forum.dlang.org/thread/lnq5m7$2jiq$1@digitalmars.com




More information about the Digitalmars-d mailing list