Making AssertError a singleton
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Tue Dec 13 13:50:30 PST 2016
On Tuesday, 13 December 2016 at 11:39:16 UTC, Guillaume Piolat
wrote:
> On Monday, 12 December 2016 at 21:02:11 UTC, Andrei
> Alexandrescu wrote:
>>
>> That will come too.
>>
>>
>> Andrei
>
> Great teaser :)
>
> For reference, here is how I currently do this:
>
> - make Object.~this() @nogc with a cast
> - throw emplaced exceptions in malloc'd memory
> - release them explicitely at catch time
>
> This probably breaks chaining so maybe RC objects are needed
> first, dunno.
It also only works if you're the one controlling all of your
code, because D code in general expects exceptions to be
GC-allocated and isn't going to do anything to free it. So, it
works under certain circumstances but not in general.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list