`Value` meta-issue
Opened this issue · 1 comments
juntyr commented
juntyr commented
I've been thinking about the ron
Value
for a few days and wanted to summarise my thoughts:
- the
Value
type should be extended to be more like aron
AST (extensions excluded?) - most issues stem from
ron
having a type system (in the data format) that is both more and less expressive thanserde
'sde::Visitor
API. On the one hand,ron
has named units, (named) tuples, (named) struct-likes, all in addition toserde
's sequences and maps. On the other hand, it does not distinguish between structs and enums. - serialising into a
Value
should be no problem, but it might be useful to not makeValue
aSerializer
itself but instead reuse the existingSerializer
to benefit from the extension handling (i.e. serialising into aValue
should give theron
as serialising to aString
) - deserialising from an extended
Value
should present little problems, but would also benefit from plugging into the existingDeserializer
to handle the unwrap extensions. That way, all non-self-describing methods should work flawlessly deserialize_any
could be adapted to supportserde
's untagged functionality ... to some extent (the unwrap extensions will never work with it since it requires support from ourDeserializer
) ... perhaps this should be a separate issue- transforming a
Value
into aron
string is trivial, but could perhaps be integrated with theSerializer
to support the samePrettyConfig
- implementing
Deserialize
forValue
is the difficult part, sinceserde
just doesn't give us sufficient information for it to work losslessly. Perhaps we should, therefore, split the functionality into (1) aValue
can be serialised and deserialised by any data format - but this does not mean you can deserialise aValue
from aron
string, and (2) aValue
can be parsed from aron
string. This change would be breaking sinceValue
'sSerialize
andDeserialize
impls would do something very different from before, while the functionality of going betweenron
andValue
would be exposed in separate methods.
@torkleyy what are your thoughts on this?