rebellion icon indicating copy to clipboard operation
rebellion copied to clipboard

Serialization friendly

Open sorawee opened this issue 4 years ago • 7 comments

It would be nice if values in Rebellion are write/read-friendly. absent, for instance, would be written as #<absent> which is not readable.

sorawee avatar Jul 03 '20 17:07 sorawee

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.

jackfirth avatar Jul 05 '20 07:07 jackfirth

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.

sorawee avatar Jul 05 '20 07:07 sorawee

Could you describe your use case more?

jackfirth avatar Jul 05 '20 08:07 jackfirth

Save results from a long computation to file so that I can analyze it later.

sorawee avatar Jul 05 '20 08:07 sorawee

Would just serializing it work? Or do you specifically want something human-readable.

jackfirth avatar Jul 05 '20 08:07 jackfirth

Serializing would work too I think.

sorawee avatar Jul 05 '20 08:07 sorawee

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.

jackfirth avatar Jul 05 '20 08:07 jackfirth