Now, I can reproduce the problem.
% cat dump.scm
(use s11n)
(define x (make-hash-table))
(hash-table-set! x 'aaa (make-hash-table))
(hash-table-set! x 'bbb (make-hash-table))
(with-output-to-file "dump"
(lambda ()
(serialize x)))
% cat undump.scm
(use s11n)
(define (deserialize-fallback id)
(cond ((string=? id "f_3497library.scm") ; chicken-2.315
equal?)
((string=? id "f_6914extras.scm") ; chicken-2.315
hash)
(else
(error "deserialize-fallback unknown id" id))))
(with-input-from-file "dump"
(lambda ()
(deserialize (current-input-port) deserialize-fallback)))
% /usr/local/chicken-2.315/bin/csi -q -s dump.scm
% /usr/local/chicken-2.41/bin/csi -q -s undump.scm
Error: (for-each) argument is not a proper list: ((aaa .
#<hash-table>) . #<procedure (hash x1094 . g10931095)>)
Call history:
<eval> (##sys#require (quote s11n))
<eval> (with-input-from-file "dump" (lambda ()
(deserialize (current-input-port) deserialize-fallback)))
<eval> (deserialize (current-input-port) deserialize-fallback)
<eval> (current-input-port)
<eval> [deserialize-fallback] (string=? id "f_3497library.scm")
<eval> [deserialize-fallback] (string=? id "f_3497library.scm")
<eval> [deserialize-fallback] (string=? id
"f_6914extras.scm")<--
% chicken-dump dump
File: dump
#0: hash table:
#1:(items) pair:
#2:(car) pair:
#3:(car) symbol:
#4:(name) string "aaa"
#5:(cdr) hash table:
(items) ()
#6:(comparison procedure) procedure:
#7:(id) string "f_3497library.scm"
#8:[1] lambda info #<lambda info (equal? x120 y121)>
#9:(hash function) procedure:
#10:(id) string "f_6914extras.scm"
#11:[1] lambda info #<lambda info (%hash x1059 limit1060)>
#12:(cdr) pair:
#13:(car) pair:
#14:(car) symbol:
#15:(name) string "bbb"
#16:(cdr) hash table:
(items) ()
(comparison procedure) back reference -> #6
(hash function) back reference -> #9
(cdr) ()
(comparison procedure) back reference -> #6
(hash function) back reference -> #9
How's it?
Daishi
On 8/1/06, Daishi Kato <[EMAIL PROTECTED]> wrote:
So, this actually is a correct way of using fallback, isn't it?
OK, I'll look for my real problem.
About the safety, don't worry too much, since this is just
a temporal solution, and
I already confirmed with chicken-dump that procedures in my file are
only equal? and hash.
Daishi
On 8/1/06, felix winkelmann <[EMAIL PROTECTED]> wrote:
> On 8/1/06, Daishi Kato <[EMAIL PROTECTED]> wrote:
> > Looks like the s11n egg is updated. So I tried, only to see I'm
> > missing something.
> >
> > Here is my fallback func:
> >
> > (define (deserialize-fallback id)
> > (cond ((string=? id "f_3497library.scm") ; chicken-2.315
> > equal?)
> > ((string=? id "f_6914extras.scm") ; chicken-2.315
> > hash)
> > (else
> > (error "deserialize-fallback unknown id" id))))
> >
> > What is missing?
> >
>
> I haven't seen your error-message yet.
> (But note that this is likely to fail, since the ID will probably be re-used
> and now name different procedures. This approach is not safe).
>
>
> cheers,
> felix
> --
> http://galinha.ucpel.tche.br:8081/blog/blog.ssp
>
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users