The D standard library is built on GC, is that a negative or positive?

bachmeier no at spam.net
Thu Dec 15 23:04:52 UTC 2022


On Wednesday, 14 December 2022 at 01:47:29 UTC, Steven 
Schveighoffer wrote:

> But if the string you give it happens to not contain a string 
> representation of an integer, it wants to throw an exception. 
> And the act of allocating and throwing that exception needs the 
> GC.
>
> We really really need to fix it. It completely cuts the legs 
> out of the answer "if you don't want the gc, use @nogc". If we 
> do fix it, all these questions pretty much just go away. It 
> goes from something like 20% of phobos being nogc-compatible to 
> 80%.

Is avoiding the GC inside exceptions a problem that needs to be 
solved? Maybe it is, but I don't think it's common to have a loop 
with millions of exceptions. Perhaps the issue is that there 
should be a version of @nogc that doesn't care about exceptions. 
With the current implementation of exceptions, the intersection 
of "avoiding GC" and "abusing exceptions" is almost certainly 
small.


More information about the Digitalmars-d mailing list