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

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Jan 12 16:17:07 UTC 2019


On Sat, Jan 12, 2019 at 03:34:02PM +0000, Seb via Digitalmars-d wrote:
[...]
> ---
> void main()
> {
>     int a = 1, b = 2;
>     assert(a == b); // ERROR: 1 != 2
> }
> ---
> 
> ```
> > dmd -run onlineapp.d
> core.exception.AssertError at onlineapp.d(4): 1 != 2

Awesome!


[...]
> Also note that with 2.085 DMD will get -verrors=context
[...]
> ---
> void foo()
> {
>     a = 1;
> }
> ---
> 
> 
> ```
> > dmd -verrors=context onlineapp.d
> onlineapp.d(3): Error: undefined identifier a
>     a = 1;
>     ^
> ```

Awesome!

It's about time dmd error messages got a facelift.  Will
-verrors=context eventually become the default?


T

-- 
The irony is that Bill Gates claims to be making a stable operating system and Linus Torvalds claims to be trying to take over the world. -- Anonymous


More information about the Digitalmars-d mailing list