rebellion
rebellion copied to clipboard
Serialization friendly
It would be nice if values in Rebellion are write
/read
-friendly. absent
, for instance, would be written as #<absent>
which is not readable.
Is there a way to get read
to produce user-defined data types? I know prop:serializable
exists for binary serialization, but I don't know of any equivalent for read
.
I don't think so. The closest is to define your struct with #:prefab
, but then you can't specify any #:property
. As I understand read
is very dumb and not even hygienic (e.g., 'a
=> (quote a)
, for whatever quote
is), so we shouldn't expect read
to produce user-defined data types.
My main motivation for this request is that, at the very least, if we can read
it, then we can write a procedure to turn the value back to the actual structure later.
Could you describe your use case more?
Save results from a long computation to file so that I can analyze it later.
Would just serializing it work? Or do you specifically want something human-readable.
Serializing would work too I think.
Making the built-in Rebellion types like option
and result
serializable (as long as their contents are) sounds like a good idea to me. Same for the collections, like multisets and multidicts. This would probably be a lot of work however, since there's a lot of different types that would need to be made serializable. Step one would be to put together a list of which types are most important to you.