On Mon, 2004-08-23 at 03:17, Leopold Toetsch via RT wrote:

> I'd rather not have the cloning in the C code. If you don't reuse the 
> nested structure descriptor, it's wasting resources.

There could be another property that tells how many times someone is
using it.  I don't think you will like that idea much either though.

On the other hand, duplicating only nested structs seems like it would
use *less* memory than cloning the entire initializer.

> I think implementing the C< clone > vtable in unmanaged struct would be 
> much cleaner. If you want to reuse a structure then clone it in the code.
> 
> The question with C< clone > just is: how deep should it copy. This 
> holds as well for arrays and hashes.
> 
> Anyway, if it's a deep copy, then we probably would need freeze/thaw in 
> the UnManagedStruct PMC.

I prefer a deep copy; I really don't want to keep around every
initializer in a complex struct such as SDL_Surface to clone each
*Struct and rebuild it every time.

-- c

Reply via email to