gendl
gendl copied to clipboard
Tasty errors on quick-save when given object expression
When you give an Object Expression (instead of package::class) to browse in Tasty, the automatic quick-save which happens with every Ajax call throws an error:
got the error #<some-package::some-type @ #x29012eb2> appears to be a GDL
object from a different object hierarchy from the current
object #<tasty:assembly @ #x2902d21a>. GDL currently does not support
writing out and reading back in GDL objects from
a separate object hierarchy.
This error will not happen if you instantiate the object via tasty by specifying a package::class.
But Tasty and/or the quick-save and readable-expression functions have to be fixed so as not to incur this error (it is because the root-object is indeed from a different tree hierarchy when you specify a pre-instantiated object to tasty, so this requires a fundamental re-working of the way the readable-expression works for this case).
In the meantime the following patch will turn this into a Warning instead of an Error:
(in-package :gwl)
(defun quick-save (self &key (snap-folder (glisp:snap-folder)))
(let ((snap-file
(merge-pathnames
(make-pathname :name (format nil "~a" (the instance-id))
:type "snap") snap-folder)))
(with-error-handling ()
(the (write-snapshot :filename snap-file)))))