On Saturday, 14 May 2022 at 01:42:21 UTC, Walter Bright wrote:
>I spoke with Atila a year ago on his excellent dpp. He handles the metaprogramming macros with a handbuilt translation of them. This works, but has to be constantly tuned. The lack of a general solution was what I was referring to.
Just extend D so that it accepts C code, then macro expansion will work. You are 90% there already.
Or rather, extend C so that it accepts D code.
So when you expand $MACRONAME(param) you inject a C-context that accepts D mixed in.
Should work 99.9% of the time. That is good enough, now you only have to manually deal with 1 in 1000. 90% is not good enough, as that means dealing manually with 1 in 10...