On 2/11/14, 9:02 AM, Dmitry Olshansky wrote:
I'm thinking that I probably should compile this discussion to some
implementable enhancement request for Phobos.

`cachedException` or some such sounds like something suitable for
std.exception.

Thoughts?

We need the following:

* a "bool caught" state in Throwable. Whenever the Throwable is thrown, that is set to false. After the Throwable has been caught (including as part of a larger chain), the runtime sets the flag to true.

* a recycleException!E(Args...) factory function that keeps a cache of exceptions of type E. If an exception has been caught, it is considered recyclable and returned. If no caught exception is available, a new one gets created.


Andrei

Reply via email to