On 2012-12-10 17:06, Dan wrote:

I think so. Here is a claim I think is true: gdup must do full deep copy
to be safe and guarantee the transitive const/immutable. If it is
implemented such that there are no casts, then the compiler does its job
and ensures everything is good. If there are casts they need to be
deemed safe - I have one cast to work around issues in associative array
iteration.

I'm pretty sure it can't be done. For classes one need to bypass the constructor. The constructor is the only place where you can initialize const/immutable fields. For class instance one would need to cast it to a ubyte pointer (or similar) and then set the const/immutable fields that way.

I think it can be done safely, but not something the compiler can guarantee.

--
/Jacob Carlborg

Reply via email to