adding properties/methods to AA's?
Bill Baxter
dnewsgroup at billbaxter.com
Tue Jul 24 18:01:17 PDT 2007
Robert Fraser wrote:
> 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.
Yeh, that would be cool. But I think it can't really work 100% of the
time without a little something extra, because sometimes there are
members that shouldn't be saved -- a member that really is just caching
something transient, for instance.
--bb
More information about the Digitalmars-d-learn
mailing list