Will macros just be syntactic sugar? [EXAMPLE]
Davidl
Davidl at 126.com
Wed Apr 25 08:15:06 PDT 2007
AST.identifiers.add(int[][3]*,x) <--- this would be required to be done b4
semantic pass.
AST.identifiers.x.static = true <-- while this need to be done after
semantic
pass.
Also the AST you suggested would make user some what not easy
understandable
code, and increase compiling time.
> 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