On exceptions in D
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Feb 11 09:33:09 PST 2014
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
More information about the Digitalmars-d
mailing list