What are AST Macros?

jmh530 john.michael.hall at gmail.com
Fri Apr 13 00:37:39 UTC 2018


On Monday, 9 April 2018 at 15:30:33 UTC, Stefan Koch wrote:
> [snip]
>
> Using templates to introspect and manipulate types is like 
> using a hammmer's flat back to remove a nail.
> It _can_ be done but with an absurd amount of work.
> You just have to remove all of the wall around the nail by 
> pounding it until the wall has around the nail is disintegrated 
> :)
>
> This is not an exaggeration.
>
> Templates used for introspection (or anything else really 
> that's modestly complex) are equally hard to reason about for 
> compilers and for programmers. I guess programmers have an 
> advantage when it comes to _efficient_ pattern recognition.

Could AST macros replace things like @safe/@nogc and enable the 
user to create their own (like a @supersafe that disallows 
@trusted)?


More information about the Digitalmars-d mailing list