msp-strath / Mary

Mary is the successor of Marx, a content delivery and assessment engine based on markdown and git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serialization of Values, Especially Environments

pigworker opened this issue · comments

We're very close to being able to serialize values, as we can now prettyprint functions. The main thing missing is that we can't yet parse or prettyprint frames. Not that there's terribly much complexity involved in doing that. Given that environments are first class values mapping identifiers to values, it would be kind of awesome to be able to just save and load them from textfiles.

At some point, we'll need to do exactly that, to achieve cross-session persistence, configuration information and all that business.

Let us suppose we have some notion of .rho file representing a serialized environment. Perhaps we might be able to invoke

mary shonkier --env=foo.rho bar.shonkier

which prettyprints the value of

foo; main()

where foo is the environment given by deserializing foo.rho.

For simple queries, we might also want to be able to invoke

mary shonkier --env=foo.rho --main="<term>"

Now, exactly what should be the programmer's interface to serialization, I'm not sure. We have lots of options...

But if we have the underlying ability, we can conjure.

That said, we may in time prefer not to spend energy prettyprinting and parsing files which are not ultimately for human consumption. We may prefer a different format for pickling and unpickling (did someone ask how to preserve sharing?), but that's a problem to solve when we have it.