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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from [email protected] ---
(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?

--

Reply via email to