RFC: reference counted Throwable

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 10:01:35 PDT 2014


On Saturday, 20 September 2014 at 14:31:36 UTC, Adam D. Ruppe 
wrote:
> How often do you store an exception reference anyway that 
> escapes a catch block? I think all this talk is overkill to 
> solve a non-problem in 99% of practice.
>
>
> Correct me if I'm wrong, but aren't *all* exceptions in a 
> particular thread generally unreferenced at the end of a 
> catch() block, unless the programmer explicitly escaped that 
> reference?
>
> If so, we don't need refcounting! Here's my solution:

I proposed something very similar in this thread[1], except I 
proposed a solution that is fully backwards-compatible except the 
rare case when exceptions are escaped, in which case it causes a 
compile-time error. Might be worth a look.

I don't think it's acceptable that code using Phobos is suddenly 
leaking until they add the new manual cleanup call.

[1] 
http://forum.dlang.org/post/stlslhjndgugecvmbowd@forum.dlang.org


More information about the Digitalmars-d mailing list