On Wednesday, 21 June 2017 at 10:51:39 UTC, ketmar wrote:
there, of course, *IS* The difference. besides the aesthetical one (seeing failed condition immediately "clicks" in your head, and generic "assertion failed" message is only frustrating), there may be the case when source code changed since binary was built. here, line number gives you zero information, and you have to checkout that exact version, and go check the line. but when failed condition dumped, most of the time it allows you to see what is wrong even without switching to the old codebase (yes, "most of the time" is from RL -- it is literally *most* of the time for me, for example).

How would you solve this issue? By pure chance, we're debating this exact same issue right now in the DIP1009 thread [1].

Solutions:

1. Make more informative asserts the compiler default. This threatens performance, which argues against it.

2. Status quo. Make people use whatever asserts they want, e.g. fluent asserts [2]. This would mean that H.S Teoh's proposed syntax for DIP1009 [3] would carry less weight, and the existing proposal would carry more. Elegance is sacrificed for the sake of versatility.

3. Allow an additional compiler flag for more informative, but heavier asserts, e.g. `-release=informativeAsserts`.

4. Allow a pragma in the code, e.g. `pragma(asserts, none/regular/informative)` for what kinds of asserts are to be used at a given moment.

 5. ???

[1] http://forum.dlang.org/post/mailman.3531.1498022870.31550.digitalmar...@puremagic.com
[2] http://fluentasserts.szabobogdan.com/
[3] http://forum.dlang.org/post/mailman.3511.1497981037.31550.digitalmar...@puremagic.com

Reply via email to