GC for noobs

Dicebot public at dicebot.lv
Fri Feb 28 03:43:56 PST 2014


On Friday, 28 February 2014 at 11:28:01 UTC, Szymon Gatner wrote:
> I didn't mean "basic" in the sense of "easy" but in the sense 
> of something that has to dealt with all the time / is common 
> requirement.

Yes, it needs to be dealt with all the time but in a different 
ways. Problem is with getting sensible defaults. D makes a 
reasonable assumption that most applications don't actually care 
about tight bullet-proof resource management and defaults to GC. 
I may not like it but it fits criteria "built-in resource 
management" and pretty much shows that it is not as basic as one 
may think.

> "Programs == Algorithms + Data structures" great man once said. 
> D is pretty damn good at algorithms part, better than C++ 
> thanks to ranges (zero cost composability codegen issues aside) 
> but data strucutres... I wish I felt the same way about them.

Most problems I have with D data structures come from qualifiers, 
not from resource management. I really don't understand why this 
looks that much of a problem. That said, my background very 
influenced by plain C and that results in different habits and 
expectations.

> Is that a limitation imposed by GC somehow? My understanding is 
> that GC has to scan from root to leaves so it knows the 
> structure exactly anyway, why not just generate finalizer call 
> list when traversing?

Can't tell because of my very limited knowledge about GC 
internals. In practice I don't care because I never ever want to 
interfere with GC resource mangement -  stuff that I want to 
micro-managed is allocated from custom pools and thus is not a 
subject to unexpected destructor calls.


More information about the Digitalmars-d-learn mailing list