GC vs Resource management.

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Sat May 3 11:40:06 PDT 2014


On Saturday, 3 May 2014 at 18:27:46 UTC, Andrei Alexandrescu 
wrote:
> On 5/3/14, 5:39 AM, monnoroch wrote:
>>
>>> Hey I have this global variable, if I assign a value to it 
>>> and later
>>> null it, it'll call its destructor if its not referenced 
>>> anywhere else.
>>> Which in turn would make me think ref counting would be a 
>>> good idea.
>>
>> It seems, that ARC is the only way. There were idea to make all
>> non-scoped (in my terminology) objects ARC-d, if they have 
>> dtors. That
>> makes sense to me.
>
> Interesting, we haven't explored that. The most problematic 
> implication would be that classes with destructors will form a 
> hierarchy separate from Object.
>
> Andrei

Yeah, that's a good point: How do you define a "class 
with/without destructor", when they all derive from Object 
anyways.

Necessarily, Object needs to have a destructor (even if it does 
nothing) for any other sub-class to have them. Or vice versa, if 
Object has no destructor, no subclass can have them?

So is it even possible to separate classes into two different 
groups?


More information about the Digitalmars-d mailing list