Serialization for D. Comments, please!

BCS none at anon.com
Tue Jun 16 17:50:55 PDT 2009


Hello grauzone,

>>> 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.
> 

I think there are ways to have a D interface implemented by a non D object.

>> 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.
> 

The demarshaller function is indexed via a string derived from the original 
object. What would the marshaller function key on? The best I can think of 
right now is the typeinfo and as of now, that's broken under DLLs

---

The solution I have now works. Unless someone can show an intractable problem 
with it I'm keeping it. The only significant issue so far voiced is the concern 
about what all that mixin is adding and I think I can kill that one with 
some minor refactoring and documentation.

p.s. could you please not delete the citation line from the quote, it makes 
it easier (at least with good NG clients) for people to find replies to there 
posts.




More information about the Digitalmars-d-announce mailing list