adding properties/methods to AA's?

Robert Fraser fraserofthenight at
Tue Jul 24 17:41:56 PDT 2007

Bill Baxter Wrote:
> [...]
> You still need to have serialize() implemented somewhere for uint, VType 
> and KType.  So what you end up having to do is what writefln does. 
> You can provide implementations of serialize() for all the built-ins in 
> the serialization module, but non-built-ins have to implement a special 
> member function (a la "toString" for writefln).
> That makes it difficult to extend the serialization system to include 
> 3rd party objects not created with your serialization framework in mind.

How about using __traits? You could serialize every primitive type normally and recursively serialize non-primitive members until they're broken down into component types.

More information about the Digitalmars-d-learn mailing list