Improving assert-printing in DMD

Nordlöw via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 26 10:36:35 PDT 2015


On Monday, 26 October 2015 at 15:17:37 UTC, Atila Neves wrote:
> Would `onAssertFailed` have an implementation in druntime?

Yes, that's my plan.

> If one is included with D after this DIP is implemented, how 
> would one override the default behaviour?

> Do I understand it correctly that `assert(a == b)` and 
> `assert(a != b)` would call different overloads?

That depends on how we want this to work.

> The reason I ask about that last one is because there's no 
> overloading of `!=` in D.
>
> Atila

Ahh, good catch.

Eventhough compiler rewrites

     X != Y

into

     !(X == Y)

and we cannot explicit overload opBinary!"!=" there is nothing 
stopping us allowing

     onBinaryAssert!"!="

in the rewriter.

I'll update

http://wiki.dlang.org/DIP83

with a proposed solution for `!=`-lowering.


More information about the Digitalmars-d mailing list