On Monday, 18 November 2013 at 20:43:51 UTC, Jacob Carlborg wrote:
On 2013-11-18 17:49, Atila Neves wrote:
How does it handle:
* Slices - are they restored?
It serialises the slice and restores it as it was, not the data
behind it. I should add some tests for that.
* Pointers - are they restored?
No, good point. I keep forgetting there are legitimate uses of
pointers in D. I was looking at the SList implementation the
other day and was surprised to see "new" used to create a struct
on the heap, something that would seem totally normal to me in
It should be easy enough to extend to pointers, I'll add that in
the next version.
* Objects - is the same object only serialized once or
I'm not sure I understand the question.
* Serializing through base class reference - possible?
No. I can't see how that would be possible without implementing
an interface (I may well be wrong), and that was the kind of
thing I really didn't want to do. Not only that, but for the kind
of code I write, I either want to send something to the network,
in which case I know which class to instantiate and don't need a
base class reference, or I want to unmarshall bytes that came in.
In the latter case there's usually an identifier in the header to
tell the factory method which class to instantiante. So that
doesn't usually come up.