Hi, 

I've encountered this behaviour of *print-dup*:

user> (defstruct foo :field)
#'user/foo
user> (binding [*print-dup* true] (pr-str (struct foo 10)))
"#=(clojure.lang.PersistentStructMap/create {:field 10})"
user> (read-string (binding [*print-dup* true] (pr-str (struct foo 10))))
java.lang.IllegalArgumentException: No matching method found: create

with both Clojure 1.2.1 and 1.3.0.

I've been wondering if this could be called a bug. Obviously, in general 
*print-dup* cannot work with struct maps, because the structure needs to be 
defined beforehand. It seems inappropriate, however, that pr-str emits an 
invalid expression that can't then be read back: either this should fail 
while printing (with the error message along the lines of "Cannot print 
struct maps when *print-dup* is true"), or work iff the structure is 
defined when reading.

Should this be considered a bug?

On a side note: are struct maps deprecated, or are they going to be? It 
seems to be the concensus that their usage is discouraged, yet they are not 
marked as deprecated in the core code.

Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to