bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29220: 26.0.90; eieio-persistent-read fail to restore saved object.


From: Noam Postavsky
Subject: bug#29220: 26.0.90; eieio-persistent-read fail to restore saved object.
Date: Sat, 18 Nov 2017 22:17:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Eric Abrahamsen <address@hidden> writes:

> (defclass person ()
>   ((name :type string :initarg :name)))
>
> (defclass classy (eieio-persistent)
>   ((teacher
>     :type person
>     :initarg :teacher)
>    (students
>     :initarg :students :initform (make-hash-table))))
>
> (setq jane (make-instance 'person :name "Jane"))
> (setq bob (make-instance 'person :name "Bob"))
>
> (setq class (make-instance 'classy
>                          :teacher jane))
> (puthash "Bob" bob (slot-value class 'students))

> Jane is `read'-able, Bob isn't. `object-write' will recurse and use
> `object-write' on any member objects, but the hashtable gets sent to
> `prin1', which I assume uses `prin1' on all its values instead:

Yes, but this is the case in emacs-25 as well.  The significant
difference seems to be in the class object:

25.3:
(eieio--object-class-tag bob) => eieio-class-tag--person
26:
(eieio--object-class-tag bob) => #2=#s(eieio--class person nil nil 
[#s(cl-slot-descriptor name unbound string nil)] #s(hash-table size 65 test eq 
rehash-size 1.5 rehash-threshold 0.8125 data (name 0)) nil ((:name . name)) 
#1=[] #1# #s(#2# unbound) (:custom-groups nil))

In Emacs 25 we have a simple symbol which will round-trip as an `eq'
object, in Emacs 26 we have a structure which will not (and furthermore
has some circularity, requiring print-circle to print readably).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]