Discussion on static reflection syntax in C++

Paul Backus snarwin at gmail.com
Mon Feb 22 23:44:45 UTC 2021

On Monday, 22 February 2021 at 23:32:39 UTC, Max Haughton wrote:
> On Monday, 22 February 2021 at 21:59:41 UTC, Paul Backus wrote:
>> On Monday, 22 February 2021 at 21:34:47 UTC, Max Haughton 
>> wrote:
>>> On Monday, 22 February 2021 at 16:27:49 UTC, Andrei 
>>> Alexandrescu wrote:
>>>> Of possible interest:
>>>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2320r0.pdf
>>> Exposing reflection information via CTFE seems like a much 
>>> more workable solution - i.e. you just write regular D code. 
>>> This is what Stefan's work effectively culminates in.
>> Or, in other words: procedural macros. (Shh, don't tell 
>> Walter.)
> They aren't macros though - at least in my mind a macro is 
> effectively a shortcut into the bowels of the compiler whereas 
> in this case the compiler wouldn't care what you do with the 
> information after it gives it to you since it's just regular D 
> code.

Aren't macros in Lisp just regular Lisp code, too? :)

As far as I'm concerned, a procedural macro is a function that

1. runs at compile time,
2. takes AST nodes as input, and
3. produces AST nodes as output.

Type functions fit those criteria perfectly. Currently, they only 
work on a subset of AST nodes (types), so they're not a 
*complete* implementation of procedural macros, but generalize 
them enough and that's what you'll get.

More information about the Digitalmars-d mailing list