Will macros work with expressions?

Reiner Pope some at address.com
Wed Sep 5 03:44:01 PDT 2007


Jari-Matti Mäkelä wrote:
> Robert Fraser wrote:
>> Jari-Matti Mäkelä Wrote:
> 
>>> If I understood it correctly, the macros only do a simple substitution
>>> using their parameters, hide symbols when necessary (hygiene) and then
>>> attach the generated code to the AST.
>> I think that's about right, but remember that their parameters can
>> specialize on any pattern and extract parts of the expression, which I
>> think is the most exciting feature.
> 
> Ah, good point. That would make overloading and recursive calls the primary
> control flow constructs then. 

Such an environment is not pleasant as it involves large code overheads. 
It's what's required in C++ template metaprogramming; D made this *much* 
nicer by introducing static if. Please don't take a step backwards with 
macros.

    -- Reiner



More information about the Digitalmars-d mailing list