[phobos] Interest in having a serializer in Phobos?

Jacob doob at me.com
Sun Aug 8 03:46:16 PDT 2010


On 8 aug 2010, at 07:47, Andrei Alexandrescu wrote:

> I think that would be great. Knowing nothing about Orange, I visited the website and read the feature lists and the tutorial (the reference seems to be missing for now). The latter contains:
> 
> auto a2 = serializer.deserialize!(A)(data);
> 
> which seems to require compile-time knowledge of the deserialized type. I'd expect the library to support something like
> 
> Object a2 = serializer.deserialize!Object(data);

This is currently not possible in the library. I'm not sure if that would be possible, how would you deserialize a struct for example? There is no factory function for structs like there is for classes. Since all the static types of the objects would be Object how would I set the values when deserializing? Or would Variant be useful here? I have not used Variant. Also due to issue 2844 (and one about getMembers returns any empty array, can't find it right now) I don't think this is currently possible.

> and fill the object with an A. I'm pretty certain you've done that, it would be great to feature that within the tutorials and documentation. I'd also expect Variant to play a role there, e.g. you deserialize something and you get a Variant.
> 
> Andrei
> 
> On 08/07/2010 10:19 AM, Jacob wrote:
>> Is there any interest in having a serializer in Phobos? I have a serializer compatible with D2 which I licensed under the Boost license. This is the description from the project page:
>> 
>> Orange is a serialization library for D1 and D2, supporting both Tango and Phobos. It can serialize most of the available types in D, including third party types and can serialize through base class references. It supports fully automatic serialization of all supported types and also supports several ways to customize the serialization. Orange has a separate front end (the serializer) and back end (the archive) making it possible for the user to create new archive types that can be used with the existing serializer.
>> 
>> It's not very well tested but if there's some interest I'm hoping on getting more people to test the library. The project page is: http://dsource.org/projects/orange/
>> 
>> /Jacob Carlborg
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos



More information about the phobos mailing list