Everything looks good except this one line:
On Sunday, 9 April 2017 at 03:26:14 UTC, Walter Bright wrote:
throw new E(string);
I don't like it for 2 reasons:
a) E e = new E(string); throw e;
Should be *exactly* the same as
throw new E(string).
I think it's obvious why.
b) Using 'new' in @nogc code feels plain wrong.
I think a library method of explicitly creating a ref-counted
throwable would be better. One can then do
E e = refCountedThrowable!(E)(string);
throw e;
or, interchangeably,
throw refCountedThrowable!(E)(string);
and
throw new E(string);
would be illegal because new cannot be called from within a @nogc
method.
(haven't ever used @nogc so I'm probably wrong)