Having better version numbers
francoisthire opened this issue · comments
I just got an issue with a tool that uses Dedukti with the master version: we change the intern representation of tree without changing the version number, hence the serialization with the Marshal module can do a segmentation fault. We should bump something in version number when we make such modifications.
There is no real need to do that. A good option is to marshal with the Closures
flag, and starting every file with a dummy closure (e.g., fun x -> x
). This way, only the binary that wrote a given .dko
is able to load it.
Well, if it does not work then the Marshal
module must be bugged... I don't see how this qualifies as a hack.
I'm not saying it wouldn't work, but rather than it might work across different binaries if by some coincidence some memory offset in the programs match up (well, and some hash colludes, which would be a pretty unlucky coincidence, but still).
Also, what I meant by hack is that is is using the closure marshalling specificities (which exist primarily because of technical reasons iirc) to replace a real versioning of output files. It isn't really hard to just add a version number (or a magic number), and it would have the very nive property that instead of simply failing on other versions, dedukti could produce a helpful error message saying which version produced the file.
All in all, I fell the closure trick is a small, quick hack which shouldn't belong in a serious long term project.
This way, only the binary that wrote a given
.dko
is able to load it.
I am not sure this is what we want. Currently the .dko
format is shared between several forks of Dedukti. It is used by dkmeta
and skcheck
in particular.
In the case of skcheck
, it is usually possible to replace skcheck foo.sk
by skindent foo.sk | dkcheck
and this gives some fexibility with respect to versions (skindent
and dkcheck
do not need to have exactly the same version) but nothing similar seems possible for dkmeta
: we need to load .dko
files to know their rewrite rules.