On Friday, 12 June 2015 at 17:58:22 UTC, Andrei Alexandrescu wrote:
On 6/12/15 10:26 AM, deadalnix wrote:

This baffles me. It seems that language designer always need to fuck up
macros either by:
- Creating a new API to spawn AST, which become a burden on the compiler development (bonus point if you expose compiler internal). - Creating a new syntax, preferably completely inscrutable so you can
pretend you are a guru while using it.

There is a good way to express AST in a language, and this is how you do it for everything else in the program : you use the damn language syntax
and grammar.

In their defense, there is a need for a metalanguage as well do manipulate ASTs themselves. That's why all macro systems just look a bit off. I suggest you give it a shot at defining a natural-looking macro system if you're up to something, but I suspect there are many subtleties to cope with.

Andrei

Good timing. Check the thread I made about statement mixins, it hase a pretty natural and simple macro syntax that is an extension of the mixin syntax. Thorough admitadly no way to manipulate ast.

Reply via email to