>>>> "Mike" == Mike Kupfer
<mike.kupfer(a)xemacs.org> writes:
Mike> There was a recent discussion on ding(a)gnus.org about problems that
Mike> recent versions of Gnus have with XEmacs. One of the issues was stated
Mike> as XEmacs not having a "printed representation for hash tables".
It
Mike> turns out that that's not strictly true, but I can see where someone
Mike> might think it's true.
Mike> The main issue is that the default format for printing a hash table
Mike> cannot be read back in.
Mike> (setq myhash (makehash))
Mike> => #<hash-table :size 0/29 0x5ef>
Mike> (puthash "a" "foo" myhash)
Mike> => "foo"
Mike> (prin1-to-string myhash)
Mike> => "#<hash-table :size 1/29 :data (\"a\"
\"foo\") 0x5ef>"
Mike> (read-from-string (prin1-to-string myhash))
Mike> => Invalid read syntax: cannot read unreadable object.
Mike> To get the right syntax you have to bind print-readably to t, as in
Mike> (let ((print-readably t)) (prin1-to-string myhash))
Mike> => "#s(hash-table :size 1 :data (\"a\"
\"foo\"))"
Mike> (read-from-string (let ((print-readably t)) (prin1-to-string myhash)))
Mike> => (#<hash-table :size 1/29 :data ("a" "foo")
0x636> . 40)
Does it really make sense to print out hash tables like this? I'm not
very familiar with xemacs hashtables, but what happens if you do
something like
(defvar obj "abc")
(puthash 1 obj myhash)
(puthash 2 obj myhash)
Then the value for both keys 1 and 2 are eq. If you read the printed
representation back in, won't the value for the two keys no longer be
eq?
Or can xemacs print objects like common-lisp using things like #1#
to make sure they're the same object?
Ray
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta