There was a recent discussion on ding(a)gnus.org about problems that
recent versions of Gnus have with XEmacs. One of the issues was stated
as XEmacs not having a "printed representation for hash tables". It
turns out that that's not strictly true, but I can see where someone
might think it's true.
The main issue is that the default format for printing a hash table
cannot be read back in.
(setq myhash (makehash))
=> #<hash-table :size 0/29 0x5ef>
(puthash "a" "foo" myhash)
=> "foo"
(prin1-to-string myhash)
=> "#<hash-table :size 1/29 :data (\"a\" \"foo\")
0x5ef>"
(read-from-string (prin1-to-string myhash))
=> Invalid read syntax: cannot read unreadable object.
To get the right syntax you have to bind print-readably to t, as in
(let ((print-readably t)) (prin1-to-string myhash))
=> "#s(hash-table :size 1 :data (\"a\" \"foo\"))"
(read-from-string (let ((print-readably t)) (prin1-to-string myhash)))
=> (#<hash-table :size 1/29 :data ("a" "foo") 0x636> . 40)
This seems awkward. Can we change the default format for printing hash
tables, or would that require a major version bump?
If we're stuck with print-readably for the foreseeable future, it seems
like the docstring for print et al should mention it.
Also, while I was playing around with this on 21.5.33, I noticed the
following oddity. Suppose I put the following text into a buffer:
#s(hash-table :size 29 :data ("a" "foo"))
If I then put point at the "#" and type
M-: (read (current-buffer))
I get a hash table back, and it has the right contents, but it's size
59, not 29. That's a bug, I guess...?
mike
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta