On Sun, 28 Mar 2010 12:50:20 -0400, bearophile <bearophileh...@lycos.com>
wrote:
Robert Jacques:
What I think you're forgetting is that all compile-time type info is
lost at runtime. [... etc]<
Thank you very much for all your explanations, I didn't know that the
situation is so terrible. I suddenly like not-GC languages more :-)
I think the compilation of D code must build a data structure that will
be used at runtime by the GC to know the type of all variables and
pointers, otherwise there's no hope in a GC that works well in
long-running programs.
The current GC has a simple "type info" if you will -- contains pointers
or doesn't contain pointers. It doesn't mean we cannot add to that. In
fact, I think dsimcha has provided a way to have precise scanning for
heap-allocated types. I don't think a reasonably precise GC is out of the
question. However, it may be too much to require the GC to do semantic
analysis of enums for unions. Not impossible, but probably not worth the
effort and restrictions necessary.
-Steve