Details
-
Type:
Enhancement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Completed
-
Affects Version/s: Release 1.4
-
Fix Version/s: Release 1.6
-
Component/s: None
-
Labels:
-
Patch:Code and Test
-
Approval:Ok
Description
Problem: clojure.walk throws exceptions if used on records.
user=> (defrecord Foo [x]) user.Foo user=> (def f (Foo. :x)) #'user/f user=> (use 'clojure.walk) nil user=> (postwalk identity {:foo f}) UnsupportedOperationException Can't create empty: user.Foo user.Foo (NO_SOURCE_FILE:1)
Current Patch: 0001-CLJ-1105-Support-records-in-clojure.walk.patch adds a special case for records.
See also: CLJ-1239 "faster, more flexible dispatch for clojure.walk" which could supersede this ticket.
Screened by: Alex Miller - I think this will likely be superseded by CLJ-1239 in the future, but this is a reasonable short-term step.
maybe clojure should follow clojurescript's footsteps and move empty out of IPersistentCollection and create an
interface IEmptyableCollection extends IPersistentCollection { IEmptyableCollection empty(); }