[Issue 13972] Make scoped, Unique, and RefCounted @nogc

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 11 13:12:01 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13972

bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc

--- Comment #2 from bearophile_hugs at eml.cc ---
(In reply to Kapps from comment #1)

> if(foo is null) {
>     static ex = cast(immutable)(new Exception("foo is null"));
>     throw ex;

I think no cast is needed:

static immutable ex = new Exception("foo is null");


> and does not help in situations where the
> exception text includes additional information from runtime arguments.

The space for the extra information could be allocated statically, and pasted
inside the buffer. But this makes the function not pure.


> Also
> I'm not sure what kind of impact this would have if called and thrown in a
> catch block.

In presence of exception chaining how are immutable exceptions working?

--


More information about the Digitalmars-d-bugs mailing list