Improving assert-printing in DMD

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


On Monday, 26 October 2015 at 17:36:37 UTC, Nordlöw wrote:
> 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?

I haven't thought about that in detail. One way would be to have 
a default implementation in druntime, say in `core.assert` that 
triggers pretty pretting when imported. For this work in a 
convenient way, it could be convenient to move logic from 
std.conv to, say, `core.conv`. `core.assert` could then import 
`core.conv` in order to reuse toString-conversion logic for, say, 
builtin types and types that have the member `string toString`.

Maybe we need to propose a set of alternatives and do a vote 
about how to solve this.


More information about the Digitalmars-d mailing list