On 11/1/10 10:59 AM, Michel Fortin wrote:
Le 2010-11-01 à 0:21, Andrei Alexandrescu a écrit :
Alright, then how do we solve refcounting of constant objects (see
Michel Fortin's question)? My solution involves casting away const
and keeping immutability information at runtime. Is that
acceptable?
I don't see a big problem in bypassing const. But const objects might
be immutable, and immutable objects are implicitly shared. So for
immutable objects you'll need to use atomic increment/decrement on
the reference counter; is this why you want to keep track of
immutability at runtime?
I keep immutability info during runtime to avoid trying to write to
immutable data.
I'm not sure about what to do for the GC affecting the reference count.
It does look like we need to use atomic refcounting, which is a major
setback for the entire approach.
In brief, if we want to go with cheap copy construction, we don't
currently have a solution.
Andrei
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos