@nogc and exceptions

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 13 19:13:24 PDT 2014


On Saturday, 13 September 2014 at 08:19:10 UTC, Marc Schütz wrote:
> On Friday, 12 September 2014 at 21:31:45 UTC, Johannes Pfau 
> wrote:
>> Am Fri, 12 Sep 2014 12:59:22 +0000
>> schrieb "Marc Schütz" <schuetzm at gmx.net>:
>>> Related: Last time I checked the runtime caches unwinding or 
>>> stack trace information in the exception. It does this even 
>>> for immutable exceptions...
>>
>> Yes, in order to avoid allocating a stack trace helper you 
>> need to cast
>> the exception from its .init property, IIRC. There's some code 
>> in
>> druntime which does that (the out-of-memory error handling 
>> code).
>
> That's not what I mean, please see here:
> http://forum.dlang.org/thread/ftakrucgtfcicfbkzwbs@forum.dlang.org#post-xmvzmufjywcsxviooivl:40forum.dlang.org

Indeed the entire exception mechanism does not account for 
immutability at all which is not surprising considering it was 
implemented in the days of D1 and there's a lot of type erasure 
going on when druntime functions are called, but it does mean any 
sighting of a non-mutable exception anywhere is a big red flag 
until we overhaul exceptions to account for immutability.


More information about the Digitalmars-d mailing list