Garbage Collection and gamedev - tl;dr Yes we want it, so let's solve it

RazvanN razvan.nitu1305 at
Mon Nov 23 03:27:48 UTC 2020

On Sunday, 22 November 2020 at 19:54:14 UTC, Ethan wrote:
> On Sunday, 22 November 2020 at 14:30:45 UTC, Ethan wrote:
>> ...longer form discussion about the exact kind of GC we want 
>> in game development...
> So chatting with Atila on beerconf. The conversation that comes 
> up, apart from this needing to be a DIP, is that I need to fill 
> out some of the ideas that I have here.
> One of the things I mentioned is that I don't get why library 
> solutions are pursued for handling memory allocations/garbage 
> collecting when the runtime already exists and can be used for 
> the same purpose. This led to highlighting that the runtime 
> should be more templatised anyway so that it can get that 
> deeper knowledge of objects via DbI. The runtime as designed 
> and implemented is about ten years behind how the language 
> progressed, so there's definitely some work that needs to 
> happen there.

I've been looking into this and the main issue that has caused 
slow progress in templatizing the runtime is the fact that the 
hooks need to be `@trusted pure @nogc nothrow`. Why? Because 
those hooks may get called from `@trusted pure @nogc nothrow` 
code and you do not want the user getting errors like "you cannot 
do that because our runtime implementation is not pure". This 
leads to all sorts of problems: some functions cannot be pure, 
others cannot be @nogc etc.

I don't know if this can be fixed without a major redesign of 
druntime. Actually, I'm not even sure that all of the hooks can 
be `pure @nogc nothrow`.

More information about the Digitalmars-d mailing list