snapshot file fails with variable sequences.
Created by: genworks
from Genworks Google Group:
'm trying to write/read a snapshot of a gendl object that contains a variable length sequence:
(in-package :gdl-user)
(define-object seq-obj ()
:input-slots
((name "not-set" :settable)))
(define-object seq-cont ()
:objects
((seq-objs :type 'seq-obj
:sequence (:indices 'nil)))
:functions
((add-obj (name)
(let ((new-index (the seq-objs (number-of-elements))))
(the seq-objs (insert! new-index))
(the (seq-objs new-index) (set-slots! (list :name name)))))))
;; Test
(defun test ()
(let ((myseqcont (make-object 'seq-cont)))
(progn
(the-object myseqcont (add-obj "First"))
(the-object myseqcont (add-obj "Second"))
(the-object myseqcont (add-obj "Third"))
(the-object myseqcont (write-snapshot :filename "seq.lisp"))))
(let ((readseqcont (read-snapshot :filename "seq.lisp")))
readseqcont))
```common-lisp
Running the test function hangs in the debugger, and readseqcont is nil.
**Imported comments:**
*By genworks on 2013-04-28 17:21:12 UTC*
Yep this looks like a big stinkbug in
```common-lisp
(defmethod readable-expression ((object hash-table) ...) )
in gendl/base/rest/source/utilities.lisp.a
This specialization of readable-expression was recently added to handle something with display-lists in tasty for the automatic snapshot files which are now saved by gdlAjax. It looks like a big assumption is being made in the hash-table expression, namely that "self" is set to anything reasonable (or anything at all) within the context of the hash-table creation, and this assumption falls into the ass/u/me category.
This is a more general problem, but the immediate problem in the case of variable sequences, the hash table really should not be saved out at all. A probable fix will be to change
(the (set-slot! :ht (the ht)))
to
(the (set-slot! :ht (the ht) :remember? nil))
This will be followed up with a patch/commit in the coming days.
By genworks on 2013-11-01 03:46:14 UTC
fixed at the source.