radical ideas about GC and ARC : need to be time driven?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Tue May 13 04:42:46 PDT 2014


On Tuesday, 13 May 2014 at 07:42:26 UTC, Manu via Digitalmars-d 
wrote:
> The other topic is still relevant to me too however (and many 
> others).
> We still need to solve the problem with destructors.
> I agree with Andrei, they should be removed from the language 
> as they
> are. You can't offer destructors if they don't get called.

Andrei only said, they are not called sometimes, not always, so 
we can guarantee destructor calls, when it can be guaranteed.

> And the usefulness of destructors is seriously compromised if 
> you can't rely
> on them being executed eagerly. Without eager executed 
> destructors, in
> many situations, you end up with effective manual releasing the 
> object
> anyway (*cough* C#), and that implies manually maintaining 
> knowledge
> of lifetime/end of life and calling some release.

I use finalizers in C#, they're useful. I understand, it's a 
popular misunderstanding, that people think, that GC must work 
like RAII. But GC manages only its resources, not your resources. 
It can manage memory without RAII, and it does so. Speaking about 
eager resource management, we have Unique and RefCounted in 
phobos, in fact, files are already managed that way. What's 
problem?


More information about the Digitalmars-d mailing list