If I had my way

Alvaro alvaroDotSegura at gmail.com
Sun Dec 11 10:50:04 PST 2011


El 11/12/2011 16:14, Chad J escribió:
> On 12/11/2011 08:15 AM, maarten van damme wrote:
>> ...
> I think one thing that could would be (optional) reference counting for
> transitively atomic types.  Of course, this is just another kind of
> garbage collection, but it is /deterministic/ and parallelizes well, and
> I bet this would open up a large amount of Phobos while the
> stop-the-world collector is offline, and with little or no code change.
>
> The big example in my mind is strings.  Strings are straight-up atomic.
>   They can't have the reference cycles that would confuse a reference
> counter.  And if we allowed them to be reference-counted, then all of
> the string functions using copy-on-write would now work with the
> stop-the-world collector disabled.
>

Yes, an alternative to GC is reference counting with immediate 
destruction. It is used for instance in Vala (a language on top of the 
GObject system, a bit reminiscent of D):

http://live.gnome.org/Vala/ReferenceHandling

But I think it would be too complicated to turn all D's arrays, objects, 
etc. into a system like this.


More information about the Digitalmars-d mailing list