Making AssertError a singleton

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 12 13:02:11 PST 2016


On 12/12/2016 02:54 PM, Shachar Shemesh wrote:
> On 12/12/16 17:51, Andrei Alexandrescu wrote:
>> Here it is:
>>
>> https://github.com/dlang/druntime/pull/1710
>>
>> It relieves code that uses assert from needing the GC. I think all
>> Errors should be singletons - multiple objects in that hierarchy
>> arguably make no sense. But of course there are many situations out
>> there. If this breaks your code, please holler.
>>
>>
>> Andrei
>
> As you may know, Weka has a huge GC aversion. Despite that fact, I fail
> to see the improvement such a change would bring.

Why am I not surprised :o).

> The only situation
> under which using the GC is not harmful is when the entire process is
> about to go kaboom anyways.

You get to use assert without needing to link in the GC.

> Now, if you'd make regular Exceptions GC free....

That will come too.


Andrei


More information about the Digitalmars-d mailing list