All asserts need to have messages attached! Explicit as possible!
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 7 18:51:34 PDT 2017
On Saturday, 8 July 2017 at 00:55:46 UTC, FoxyBrown wrote:
> [...]
> It should be mandatory that all asserts, throws, etc provide
> correct information about not only the point of the error but
> also the location and what caused it. [...]
Error messages are sensible when they provide context (e.g. for
complex conditions).
In my experience, though, most asserts exist to cover fairly
obvious cases, where an additional message would just add noise:
---
struct SomeRange
{
bool empty() { ... }
void popFront()
{
assert (!empty);
...
}
}
---
More information about the Digitalmars-d
mailing list