Escaping the Tyranny of the GC: std.rcstring, first blood

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 25 02:25:22 PDT 2014


Walter Bright:

> Consider that people complain a lot about annotations.

It's much better to try to quantify how much this "a lot" means, 
even roughly. Otherwise you can't reason on anecdote. (I think D 
annotations are a burden, and their return of investment is 
currently not large, but so far they are acceptable for me. We 
can discuss possible ways to improve the situation).


> See the other thread. Adding the scope annotations everywhere
> is a LOT of annotations. Do you think people will be happy with 
> that?
> I don't.

How much is that "a LOT"? I'd like you to give this idea a chance 
to show its advantages in practice. Removing problems like this, 
and at the same time giving a help to garbage collection 
(reference counting is another kind of garbage collection. And it 
has some costs) is good:

int* foo() @safe {
     int[10] a;
     int[] b = a[];
     return &b[1];
}
void main() {}


So it's a matter of weighting the costs of a system to track 
ownership of memory areas compared to the costs in correctness 
and performance of the current situation (or the current 
situation plus an additional garbage collection strategy).

Lately for me correctness has become very important (more than 
for the author of the video about video game language design), I 
am willing to work more when I think about the code and adding 
some annotations if this avoids me the wasted time to search bugs 
or avoids me troubles with too much GC activity when the program 
gets larger (as shown by Maxime Chevalier-Boisvert).

Bye,
bearophile


More information about the Digitalmars-d mailing list