A thought about garbage collection

deadalnix deadalnix at gmail.com
Wed Dec 19 17:15:50 PST 2012


On Thursday, 20 December 2012 at 00:56:30 UTC, jerro wrote:
>> In your D code what's the percentage of class instantiations 
>> done with scoped()?
>>
>> Bye,
>> bearophile
>
> I don't think I've ever actually used it (other than just 
> trying it). When I use classes, I usually want them to be heap 
> allocated. But if you need a class instance on the stack, 
> scoped() looks useful. Are there some issues with it that I'm 
> not aware of?

It is unsafe :D But otherwise works properly.

LDC also plan to provide a pass that remove many allocation when 
it can prove that thing don't escape scope. I don't know if that 
went into the lastest version, last time I heard of it it was 
experimental.


More information about the Digitalmars-d mailing list