ron
ron copied to clipboard
`Value` meta-issue
Just to start tracking all the Value related ones - I'll try to tackle them in v0.9 and v0.10:
- [x] #357
- [ ] #328
- [ ] #255
- [x] #217
- [ ] #189
- [ ] #140
- [ ] #122
- [x] #115
- [x] #407
- [x] #456
- [x] #445
- [x] #436
- [x] #438
- [ ] #411
- [x] https://github.com/ron-rs/ron/pull/481#issuecomment-1688676883
- [x] #488
- [x] #321
I've been thinking about the ron Value for a few days and wanted to summarise my thoughts:
- the
Valuetype should be extended to be more like aronAST (extensions excluded?) - most issues stem from
ronhaving a type system (in the data format) that is both more and less expressive thanserde'sde::VisitorAPI. On the one hand,ronhas 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
Valueshould be no problem, but it might be useful to not makeValueaSerializeritself but instead reuse the existingSerializerto benefit from the extension handling (i.e. serialising into aValueshould give theronas serialising to aString) - deserialising from an extended
Valueshould present little problems, but would also benefit from plugging into the existingDeserializerto handle the unwrap extensions. That way, all non-self-describing methods should work flawlessly deserialize_anycould 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
Valueinto aronstring is trivial, but could perhaps be integrated with theSerializerto support the samePrettyConfig - implementing
DeserializeforValueis the difficult part, sinceserdejust doesn't give us sufficient information for it to work losslessly. Perhaps we should, therefore, split the functionality into (1) aValuecan be serialised and deserialised by any data format - but this does not mean you can deserialise aValuefrom aronstring, and (2) aValuecan be parsed from aronstring. This change would be breaking sinceValue'sSerializeandDeserializeimpls would do something very different from before, while the functionality of going betweenronandValuewould be exposed in separate methods.
@torkleyy what are your thoughts on this?