Improving assert-printing in DMD
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Oct 2 06:21:32 PDT 2015
On 10/02/2015 08:27 AM, Per Nordlöw wrote:
> On Friday, 2 October 2015 at 12:15:13 UTC, Per Nordlöw wrote:
>> I guess we only need on symbol name for `onAssertFailed` then instead
>> of `assertBinOp` and `assertUnOp`, right?
>
> And two overloads
>
> Binary case:
>
> onAssertFailed(string op)(e1, e2, __FILE__, ...)
>
> Unary case:
>
> onAssertFailed(string op)(e, __FILE__, ...)
>
> I presume?
Sounds good.
> Because number of arguments to each overload will be fixed, right?
>
> What about the case
>
> assert(f(expr))
> assert(symbol)
>
> Should `op` be empty in that casesor should we use yet another overload
>
> onAssertFailed(e, __FILE__, ...)
>
> for that case?
I'd say lower the same as (e !is 0) for numerics and (e !is null) for
the others.
Andrei
More information about the Digitalmars-d
mailing list