Serialization for D. Comments, please!

grauzone none at example.net
Tue Jun 16 15:27:24 PDT 2009


>> Huh? You can simple cast the interface to an object.
> 
> That is not safe. not all interface instances are D objects.

There are people who care for COM and C++ interfaces? COM is Windows 
specific, and C++ vtables are... uh, I don't know, 
platform/architecture/compiler vendor specific?

In any case, serializable objects shouldn't contain references to such 
interfaces in the first place.

> And that just brought up another issue: how do you serialize a class 
> that only ever shows up as a base class reference? The lib has no way to 
> /find/ the type at compile time so it has no way to generate code to 
> deal with it.

But you already handle this. One of your mixins contains a static this 
ctor (which, btw., makes it impossible to use serializable types in 
cyclic dependent modules). It seems right now this ctor is only for 
registering the demarshaller function, but the same can be done with the 
marshaller function.


More information about the Digitalmars-d-announce mailing list