On Monday, 8 February 2016 at 11:22:45 UTC, thedeemon wrote:
On Saturday, 6 February 2016 at 08:07:42 UTC, NX wrote:
What language semantics prevent precise & fast GC
implementations?
Unions and easy type casting prevent precise GC.
Lack of write barriers for reference-type fields prevent fast
(generational and/or concurrent) GC. Some more detailed
explanations here:
http://www.infognition.com/blog/2014/the_real_problem_with_gc_in_d.html
I see... By any chance, can we solve this issue with GC managed
pointers? AFAIK, this is what C++/CLR does: There are 2 different
pointer types, (*) and (^). (*) is the famous raw pointer, second
one is GC managed pointer. A GC pointer has write barrier (unlike
raw pointer) so we can have both raw C performance (if we want)
and fast generational GC or concurrent GC (which are a magnitude
better than a mark and sweep GC).
As you realized, there is a major problem with this: classes. The
desicion of making classes reference-type is actually fine
(+simplicity), but it doesn't really help with the current
situation, I expect D to be pragmatic and let me decide. Maybe in
future... Who knows...