DIP 50 - AST macros
Don
x at nospam.com
Tue Nov 12 03:06:16 PST 2013
On Tuesday, 12 November 2013 at 09:55:20 UTC, Walter Bright wrote:
> I forgot to mention that "expression templates" can be used in
> D in an equivalent manner that they are used in C++,
They are crippled compared to C++, because you have no control
over the return type of opCmp and opEquals, which means that you
can't have expression templates involving comparisons. That's
extremely limiting.
My feeling with AST macros is:
(1) AST macros are basically syntax sugar for string mixins. The
one and only thing that string mixins have in their favour, is
that they have almost no syntax. But that is actually a *huge*
plus.
Because it's syntax sugar, an AST macro syntax would be most
convincing if you took some existing string mixins from various
real projects, and show how beautiful they would become with
macros.
(2) The big functionality we don't have, is comprehensive
reflection. I'd like to see more thought in that area. It seems
challenging to define reflection in a way that doesn't expose
compiler internals.
The question I find particularly interesting is, "if we had
macros, would reflection look different?"
More information about the Digitalmars-d
mailing list