About GC: The Future of Rust : GC integration

Matthias Bentrup via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 8 06:08:52 PDT 2016


On Wednesday, 8 June 2016 at 03:19:18 UTC, Jack Stouffer wrote:
> On Wednesday, 8 June 2016 at 03:10:32 UTC, Eugene Wissner wrote:
>> In D some very important things like exceptions depend on GC.
>
> This is a common misconception. Exceptions do not have to use 
> the GC, they just often are. All you have to do is malloc an 
> exception and then throw it, and then remember to free it after 
> you catch it up the call stack.
>
> The Phobos developers made the decision to use the GC in order 
> to be @safe rather than fast.

Exceptions and memory allocation are a pain to use anyway. When 
you call a function that calls a function that calls a function, 
and you get an Exception, how do you know how to properly 
deallocate it ?

And it's not just the Exception Object itself, usually you also 
have to allocate at least a string for the Exception message.


More information about the Digitalmars-d mailing list