On Friday, 27 February 2015 at 07:09:20 UTC, Benjamin Thaut wrote:
Am 27.02.2015 um 00:05 schrieb deadalnix:
Note that in D, you have union and all kind of crap like that,
so what
is writing a pointer is non obvious and so the tradeof is very
different
than it is in other languages.
To have any chance of implementing a better GC in D I would
simly start of with assuming all code is @safe. For code that
is not @safe the user would have to make sure it plays nice
with the GC. This would also apply to unions which contain
pointer types. If you wan't to write a good GC that does
support non @safe features without user input you don't even
have to start in my opinion.
That is a reasonable approach (and indeed, I would assume that
@system code have to ensure that it does not do something that
will confuse the GC).
Still, what you can do when compiling AOT is different than what
you can do when you JIT. For instance, when you JIT, you can add
write barrier and remove them on the fly when you need to. When
doing AOT, they must be always on or always of.