usable @nogc Exceptions with Mir Runtime

9il ilyayaroshenko at gmail.com
Fri Nov 2 07:41:57 UTC 2018


On Friday, 2 November 2018 at 07:00:49 UTC, Manu wrote:
> On Tue, Oct 30, 2018 at 9:30 AM Oleg via Digitalmars-d-announce 
> <digitalmars-d-announce at puremagic.com> wrote:
>>
>> Thanks for your work!
>>
>> > Example
>> > =======================
>> > ///
>> > @safe pure nothrow @nogc
>> > unittest
>> > {
>> >     import mir.exception;
>> >     import mir.format;
>> >     try throw new MirException(stringBuf() << "Hi D" << 2 <<
>> > "!" << getData);
>> >     catch(Exception e) assert(e.msg == "Hi D2!");
>> > }
>> >
>> > =======================
>>
>> I don't understand why you choose C++ format style instead of 
>> D-style format?
>
> Perhaps this is a stupid question... but there's clearly `new
> MirException` right there in that code.
> How is this @nogc?

The code requires -dip1008 flag. Take a look into the DIP 
https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md


More information about the Digitalmars-d-announce mailing list