Michael Heerdegen <
michael_...@web.de> writes:
> Eric Abrahamsen <
er...@ericabrahamsen.net> writes:
>
>> And the solution needs to be making the process equally recursive,
>> because right now it's entirely possible that other packages could start
>> using eieio-persistent with weird data structures, and fall afoul of
>> this asymmetry. It's not just about quotes: if another package starts
>> stashing EIEIO objects inside nested hash tables, they will be written
>> correctly, but read incorrectly.
>
> I think I would make it so that what is written in the save file is an
> expression that, when read _and_ evaluated, would return the recovered
> object. The approach on the object-write side would not be much
> different than now, but the restoring part would be trivial, so code
> changes would become less problematic.
Part of the principle of the thing is that `eval' is never called, as
a nod to code safety. Object creation is the only actual code to run,
and it should be done by feeding the serialization to EIEIO functions,
rather than `eval'ling anything.
>> My next stab at a fix is in the attached patch. Michael, assuming I
>> haven't exhausted your patience,
>
> My patience here lasts as long as necessary, don't worry :-)
That's good!
>> would you mind giving this a try? I do believe this is the right
>> solution, or at least the best minimal solution.
>
> So far this fixes quote accumulation completely for me - Great! I
> didn't yet try to use the registry explicitly, so I can't say whether
> your fix works correctly. Anyway - thanks so far!
That's good to hear, though I've thought this was fixed a couple of
times already, so I'm not celebrating yet!
> FWIW, when I read the sources, I got the impression that all conses are
> handled as if they were true lists. Trying to save conses whose cdr is
> not consp will probably error, since the current code always seems to
> try to iterate over list elements.
You mean values like '(bob)? This seems to work okay:
(defclass persist-test (eieio-persistent)
((slot1 :initarg :slot1 :type list)))
(setq test (make-instance
'persist-test
:file (concat user-emacs-directory "persist-test.dat")
:slot1 '(bob)))
(eieio-persistent-save test)
(setq test2 (eieio-persistent-read
(concat user-emacs-directory "persist-test.dat")))
(slot-value test2 'slot1)
Did you mean something else?
Eric