Let's improve D's exceptions
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 18 00:20:19 PDT 2015
Am Thu, 14 May 2015 01:31:21 +0000
schrieb "Adam D. Ruppe" <destructionator at gmail.com>:
> Refresh this:
> http://arsdnet.net/dcode/exception.d
>
>
> It now has my enforce 2.0 proof of concept draft.
>
> Usage:
> alias enforce = enforceBase!MyExceptionBase;
> import core.stdc.stdio;
> enforce!fopen("nofile.txt".ptr, "rb".ptr);
>
> Message:
>
> MyExceptionBase at exception.d(38): fopen call failed
> filename = nofile.txt
> mode = rb
> ----------------
> stack trace here
Yep, implemented something like that too. I worry about the
code bloat, but it sure is powerful.
It did fail with vararg C functions though :p
@nogc Exceptions would also be nice in my opinion.
I can agree with your ideas, although I never found the
Throwable really bad. It gets the job done.
--
Marco
More information about the Digitalmars-d
mailing list