GC for noobs

Szymon Gatner noemail at gmail.com
Fri Feb 28 03:28:00 PST 2014


On Friday, 28 February 2014 at 10:44:22 UTC, Dicebot wrote:
> On Thursday, 27 February 2014 at 18:29:57 UTC, Szymon Gatner 
> wrote:
>> I dig flexibility, I really do, and I appreciate D's features 
>> that enable that, but in case of such basic thing as a 
>> resource management, I just want things to work without 
>> surprises by default.
>
> Resource management (including memory management) is on of most 
> complicated areas in programming. I can call it anything but 
> basic.

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.

"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.

Is it really so much to ask for? That child's finalizers are 
called before parent finalizer (assuming no circular refs, then 
again there are no weak class refst in D right)? Parent holds 
references to them for crying out loud... Why is that not the 
default and obvious behaviour? 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?


More information about the Digitalmars-d-learn mailing list