About useful assert error information

Seb via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 21 00:22:57 PST 2016


(Just picking out a random item from the list at [1] and showing 
the current progress and giving a good point on where to start. 
Maybe we can do this with the entire list?)

> The assert statement is "dumb" in a way that it doesn't show me 
> what data it actually compared, making using pure-assert in 
> unittests a very cumbersome task. Pretty much every slightly 
> bigger project I have see wraps assert in some other function 
> to display useful information about the specific check. I would 
> consider a useful-by-default assert statement to be very 
> valuable, especially because it could show much more and nicer 
> information and we could all drop our workarounds.

There has been a lot of work on this, e.g.

https://issues.dlang.org/show_bug.cgi?id=5547
http://wiki.dlang.org/DIP83
https://github.com/dlang/dmd/pull/5189

and for the record a DMD PR 
(https://github.com/dlang/dmd/pull/263) was rejected, because:

> this is more properly the domain of a library template

However, the library PR got rejected, because it it should better 
be done in the compiler:

https://github.com/dlang/phobos/pull/4323

I think the best solution is to push DIP83 to the new DIP process 
and thus convince Walter that useful asserts should be part of 
the compiler.

[1] http://forum.dlang.org/post/o3cdl9$ecs$1@digitalmars.com


More information about the Digitalmars-d mailing list