My late christmas present for you: context-aware assertion error messages

Seb seb at wilzba.ch
Tue Jan 15 10:23:32 UTC 2019


On Tuesday, 15 January 2019 at 08:43:06 UTC, Kagamin wrote:
> On Saturday, 12 January 2019 at 15:34:02 UTC, Seb wrote:
>> void main()
>> {
>>     int a = 1, b = 2;
>>     assert(a == b); // ERROR: 1 != 2
>> }
>
> But 1!=2 is true :)
> Maybe do it the C way "assertion 1 == 2 failed"? Also there's 
> in operator.

Hmm you have a point there. How do other people feel about this?

My main motivation was to be able to see the actual values 
(instead of just an AssertError), so I would be more than happy 
to change the format of the message.


More information about the Digitalmars-d mailing list