On Tue, Nov 12, 2013 at 9:55 PM, Dmitry Olshansky <dmitry.o...@gmail.com> wrote:

> If we just had:
>
> //this would invoke compiler's parser at CTFE
> auto ast = "x = y;".astof
>
> and have it work at CTFE to return sensible AST (a big if btw).
>
> And then (after some manipulations):
> ast.toString() //get back a string of D code

Which you still have to mixin, btw. Which means any tree manipulation
you do must be done at compile-time.
Unless, of course,  you then put the resulting code into another file,
to be compiled and loaded afterwards.


> It may help code generation of D --> DSL.
>
> Alternatively one can implement D parser that works at CTFE and watch it 
> crawl :)

*cough cough*

But, as other have said, these would be very un-hygienic macros, with
no knowledge of the surrounding environment.
Unless said CT-compatible parser could also somehow determine the
local symbols (you could pass it 'by hand', but who would do that,
realistically?)

Reply via email to