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

Seb seb at wilzba.ch
Tue Jan 15 10:17:47 UTC 2019


On Tuesday, 15 January 2019 at 08:47:24 UTC, Kagamin wrote:
> And what happens to other expressions?
>..
> assert(c.has(d)); // ERROR: c.has(d)
>
> The message will have an opposite meaning?


https://run.dlang.io/is/mRQM02

---
core.exception.AssertError at onlineapp.d(5): assert(a.has(b)) failed
----------------
??:? _d_assert_msg [0x2bf174b4]
??:? _Dmain [0x2bf173ed]
---

It falls back to printing the stringified raw expression as the 
changelog states [1].


(this is still an improvement compared to the current 
"AssertError" without any information)

[1] https://dlang.org/changelog/pending.html#assert


More information about the Digitalmars-d mailing list