On 2010-10-19 17:52, Denis Koroskin wrote:
On Tue, 19 Oct 2010 12:37:35 +0400, Jacob Carlborg <[email protected]> wrote:

What types does this support, all types? Does it support array slices?


Classes, structs, built-in types, arrays, slices - just about anything.
For classes to work you need to implement ISerializable interface using
mixin Serializable; so that it could serialize through base class pointer.

Not that I think about it, it doesn't support built-in associative
arrays yet. I forgot about that one (it might be tricky to serialize it
into a sequential memory block). Take a loot at the tests (there are
many of them, some of them are very tricky), and give it a try.

I'm kind of amazed how sort the code is and that you managed to support delegates. A suggestion, support classes without the mixin if they're not serialized through a base class reference.

I might have found a bug:

struct Foo
{
    int[] arr;
}

public void test0() {
    Foo src;
    src.arr = [0, 1, 2, 3, 4, 5];               
    auto dst = deepCopy(src);
        
    assert(src.arr is dst.arr); // passes, but should fail ?
}

The assert passes but should fail, otherwise it's not a deep copy.

--
/Jacob Carlborg

Reply via email to