Maybe another way to do compile time rewrites
Tofu Ninja via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 20 22:11:43 PDT 2014
On Saturday, 21 June 2014 at 04:34:50 UTC, 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!
If that was as effective as doing it at compile time, then any
language could do it and we would have never needed/wanted all
the compile time features that we have now.
More information about the Digitalmars-d
mailing list