Smart pointers instead of GC?

Michel Fortin michel.fortin at michelf.ca
Sat Feb 1 06:56:03 PST 2014


On 2014-02-01 09:27:18 +0000, "Adam Wilson" <flyboynw at gmail.com> said:

> That's kind of my point. You're asking for massive changes throughout 
> the  entire compiler to support what is becoming more of an edge case, 
> not less  of one. For the vast majority of use cases, a GC is the right 
> call and D  has to cater to the majority if it wants to gain any 
> significant mindshare  at all. You don't grow by increasing 
> specialization...

Keep in mind that improving the GC we have now is probably going to 
require pretty much the same changes in the compiler, perhaps even more 
drastic ones than ARC.

To make it short, to implement a concurrent GC the compiler must add 
some code for each pointer assignment and each pointer move. To 
implement ARC, the compiler must add some code only to pointer 
assignments.

The point is, unless we're satisfied with the current GC 
implementation, those massive changes to the compiler will need to be 
done anyway. From the compiler's point of view ARC or a better 
concurrent GC have pretty similar requirements. And given current D 
semantics (where stack variables are movable at will) ARC is easier to 
implement than a concurrent GC.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca



More information about the Digitalmars-d mailing list