What's up with the assert enhancements proposed years ago?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 23 16:57:10 PDT 2016


On Friday, September 23, 2016 16:57:49 Nick Sabalausky via Digitalmars-d 
wrote:
> Some ages ago, a whole suite of "assertPred" functions were written
> (giving better diagnostic info, like showing "expected vs actual"), were
> totally awesome, were submitted to phobos...and were rejected because it
> was deemed both easy enough and preferable to get these features by
> modifying DMD to add behind-the-scenes AST magic to "assert".
>
> So...umm...yea...whatever happened to that beefed-up "assert" feature?

It was rejected: https://issues.dlang.org/show_bug.cgi?id=5547

Basically, the review that involved assertPred determined that it would be
better to hav assert do it, but when someone tried to put in in the
compiler, Walter rejected it, saying that it should be a library solution.
There are also some potentially issues having assertions print out
additional information in the case where the assertion is not in a unit
test and there was concern over that.

The big problem with assertPred though is that while it's really nice, it's
also really expensive. All of those template instantions really added up.
So, I don't know if it's ultimately a good idea or not, but I'd fully expect
some of the unit testing libraries to have something similar, even if it's
not anywhere near as fancy.

- Jonathan M Davis



More information about the Digitalmars-d mailing list