Clojure

print-dup form unreadable for collections without create(IPV)

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Approval:
    Triaged

Description

print-dup assumes all IPersistentCollections not defined via defrecord have a static create method that take an IPersistentCollection, but this is not true for many clojure collections

Printing

user=> (print-dup (sorted-set 1) *out*)
#=(clojure.lang.PersistentTreeSet/create [1])

Can't read back

(read-string "#=(clojure.lang.PersistentTreeSet/create [1])")
ClassCastException Cannot cast clojure.lang.PersistentVector to clojure.lang.ISeq  java.lang.Class.cast (Class.java:3356)

Possible Fixes

  • add create methods taking IPersistentVector to collections
  • emit something different from print-dup

See also CLJ-1733.

Activity

Hide
Nicola Mometto added a comment -

CLJ-1733 adds a fix for sorted sets

Show
Nicola Mometto added a comment - CLJ-1733 adds a fix for sorted sets
Hide
Stuart Halloway added a comment -

Would be nice to have a test that looped through all the collection types.

Show
Stuart Halloway added a comment - Would be nice to have a test that looped through all the collection types.
Hide
Stuart Halloway added a comment -

Moving the conversation to CLJ-1733 since that already has a partial patch.

Show
Stuart Halloway added a comment - Moving the conversation to CLJ-1733 since that already has a partial patch.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: