Beginning with D

Rainer Deyke rainerd at eldwood.com
Thu Feb 26 11:51:30 PST 2009


grauzone wrote:
> Going back from D to C++ also feels like stepping back, because C++
> doesn't natively support garbage collection. While I admit that
> reference counting is better for "heavy" resources (like file handles),
> for small memory objects tracing garbage collection is actually more
> efficient and less problematic. For example, reference counting can't
> deal with cycles of garbage.

Between cycle-breaking and support for "heavy" resources, I'd take the
latter over the former any day.  IME heavy resources are very common,
and cycles are relatively rare.  This is especially true for game
programming.

I have many options for handling cycles in C++.  I have no reasonable
options for handling heavy resource in D1.

> And what's so great about wrapping every pointer into a smartpointer?

Consistent syntax?  Having a choice of smart pointers?

Honestly, I can't see a way to avoid smart pointers even in D2.  A
language like Python may not need them, but then Python has reference
counting and destructors that actually work in addition to garbage
collection.  And weak references.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list