DIP 50 - AST macros

Jacob Carlborg doob at me.com
Mon Nov 11 02:55:22 PST 2013


On 2013-11-11 11:39, Timothee Cour wrote:

> yes, I think your initial example becomes more interesting with this, as
> in its current form it can already be done in current D.

The current example prints out the exact expression what was passed to 
the assert macro. Not the result of evaluating the expression. I don't 
see how this can currently be done in D

> This would make error messages self-documenting:
>
> myAssert(!file.exists );
> // "!file. exists" failed: dump of AST:
> file: string ="foobar.d"
> |_file.exists: bool = false
>    |_!file. exists: bool = false
>
> In many cases, this would be so much more useful than an out of date /
> incomplete string error message, esp w a lot of variables involved.

I agree.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list