On 8/2/23 7:40 AM, Nick Treleaven wrote:
Presumably an allocation like `new T` (for a type with a @safe constructor) can be made anywhere a call to `GC.collect` can be made, which may trigger a collection. So why isn't `GC.collect` marked @safe?
It should be. Maybe historical reasons?One possible (but wrong) reason is that destructors can be unsafe. But you are correct in that allocation can cause a collection.
-Steve