Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[imp-dev] Idea to facilitate PDB (de)serialization

Hi guys,

I've added a prototypical reader and writer to the PDB (XMLReader and
XMLWriter). The idea is to show what kind of validation needs to be
done when deserializing IValues and to provide a (limited) bridge to
XML. Pdb.test contains examples of their usage.

That's not the end of PDB serialization of course. More work needs to be done:
  - efficient serial format: we're currently making reader and writer
for the different ATerm formats (shared, binary), but more formats
could be developed.  This ATerm stuff will not be committed to PDB for
now,
    since it needs a proper CQ.
  - (optional) readers/writers for well known formats such as
S-expressions, YAML, J-son, Java property files, ...
  - The PDB itself needs serialization.
  - for the previous, types need serialization.

My idea is to change the "String Type.getTypeDescriptor()" method
which now returns a String to: "IValue
Type.getTypeDescriptor(IValueFactory factory)";
This method will return a value representing a type, build using a
ValueFactory of choice and a fixed set of type definitions for Types.
The TypeFactory will contain a method "Type
TypeFactory.fromTypeDescriptor(IValue typeDescriptor)" to recreate a
type from its descriptor.

As a result, to serialize a type, one can get the TypeDescriptor and
then use any IValueWriter. To deserialize a type, one can get any
IValueReader and then call fromTypeDescriptor.
And more interestingly, this should make it possible to serialize the
entire PDB using an IValueWriter of choice.

Two questions:
  - do you have any questions or suggestions?
  - do you use getTypeDescriptor() in other projects I don't know
about? Any issues when I change it?

Cheers,

Jurgen


Back to the top