A thought about garbage collection

bearophile bearophileHUGS at lycos.com
Wed Dec 19 18:19:17 PST 2012


Jonathan M Davis:

> The problem is casting. It's not uncommon to create something 
> as mutable and
> then cast it to immutable when done. It's stuff like that 
> screws with being
> able to per-thread GCs. Which thread owns what isn't always 
> clear.

I nearly never cast mutables to immutable. The purpose of casts 
is to subvert the type system. If you accept that some type 
system assumption doesn't hold just because casts exist, then you 
are doomed to ignore every kind of type system assumption, like 
immutability, safety, purity, nothrowness, and so on. And this is 
so wrong. So I can't accept your justification that the existence 
casts disallow per-thread GCs. Do not use cast that way, and give 
us a "better" GC.

Bye,
bearophile


More information about the Digitalmars-d mailing list