Open dimpase opened 5 years ago
@dimpase I have IO_PickleToString
and IO_UnpickleFromString
(see https://gap-packages.github.io/scscp/doc/chap9.html#X84F055ED860120D5). Historically this appeared in SCSCP to satisfy its needs, and I am happy to submit a PR and move them to IO.
This looks like a reasonable thing to do, thanks in advance!
PRs welcome :-)
Stupid question, isn't what you want already there (this doesn't let you specify a memory block (edit: was group)). This has been there since 2011.
gap> s := IO_Pickle(Group((1,2,3)));
"PRMGILIS\>1PERM\>7(1,2,3)FAILFAIL"
gap> IO_Unpickle(s);
Group([ (1,2,3) ])
Quickly checking, I notice this isn't documented, so that's a problem :)
Document it, or it doesn't exist! :-)
And so we'd be busily picking GAP groups.
I don't understand what do you mean by saying that it doesn't let you specify a group.
I meant existing memory block, which you mentioned, obviously had groups on the brain.
Just in case you hit it, if you pickle permutation groups which are the results of GAP computations you might hit https://github.com/gap-packages/io/pull/91 ( which was just found by me, and fixed, a few days ago). This will only be a problem if you pickle the identity group, and only then the identity group returned by some GAP methods.
Sometimes it is better to have a pickle to a string, or to a memory area, e.g. in libgap setting, where GAP objects might be parts of a bigger structure that needs to be pickled, e.g. a Python one, cf https://docs.python.org/2/library/pickle.html
I imagine it should not be too hard to provide, as the existing in IO code surely has all the needed parts available, but is these a chance such a change is accepted and merged?