On Mon, Nov 11, 2013 at 2:55 AM, Jacob Carlborg <[email protected]> wrote:

> 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


I'm using a modified assert that uses the ugly import(file)[line] trick, so
that can be done (but is really ugly and has impact either runtime or
compile time). But we're essentially in agreement.


>
>
>  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
>

Reply via email to