DIP 50 - AST macros

Jacob Carlborg doob at me.com
Wed Nov 13 06:11:40 PST 2013


On 2013-11-13 12:49, Rikki Cattermole wrote:

> AST macros currently suggested do not work at the same stage as mixins,
> as far as I am aware. They work at a much earlier stage. Mixins have
> limits because of there lateness in lexing process.

I think macros would work on the same stage as mixins.

> Assuming a lexer is available it could check that any code given to a
> macro is correct. I will be submitting a pull request for pragma error
> and warning so if it is not valid the macro could fire a compile error.

All macro invocations are already checked. They're lexed and parsed. 
Marcos work at the semantic phase. Then when the macro is returned the 
resulting AST is typed checked as usual.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list