Will macros just be syntactic sugar? [EXAMPLE]
Dan
murpsoft at hotmail.com
Wed Apr 25 07:24:00 PDT 2007
Davidl Wrote:
> Nice work!
> The compiler now is damned powerful :)
>
> Though I still prefer less string operation in compile time, any idea of
> improving the
> macro syntax I posted? You see, D is going to bring AST macro in future
> releases. Let's
> discuss the syntax it will use?
The AST Reflection is IMHO a concept capable of becoming powerful enough to rival mixins, and without "compile time text processing"; apart from the compiler processing the source code. : p
AST Reflection is basically an API that would allow you to define/access any D statement or expression as if it were a library. I honestly don't know what it ought to look like...
AST.identifiers.Foo <-- gives you a Foo
AST.statements.If <-- capitalized so you don't use a keyword?
AST.identifiers.add(int[][3]*,x) <-- adds a variable
AST.identifiers.x.static = true <-- makes x static?
Just my thoughts. While this sort of thing at first appears verbose and trivial, it ultimately lets you do really cool stuff with it?
More information about the Digitalmars-d
mailing list