GC-proof resource classes

cym13 via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 29 07:10:11 PDT 2015


On Saturday, 29 August 2015 at 14:00:59 UTC, ponce wrote:
> On Saturday, 29 August 2015 at 13:43:33 UTC, cym13 wrote:
>> But nobody's linking the destructor to it because of the 
>> separation of concerns principle: we release what has to be 
>> released and only that: freeing the object is the realm of the 
>> GC.
>
> I see what you mean, but Unique!T, RefCounted!T and scoped!T 
> call the destructor, not the release() function you just 
> defined. So separating concerns break those.

Yes, and I think it is kind of cumbersome actually. Being able to 
pass a method to scoped!T for example would be really great (with 
the destructor as default of course).


More information about the Digitalmars-d mailing list